Gossamer Forum
Quote Reply
=> Operator
Heya,

I have a small script with the following line:

Code:
my $sth = $tbl->select(['Full_Name'], { FatherID => '0' });

FatherID can have any value including 0 (zero). The line above obviously selects all records where the FatherID field = 0. How do I rewrite this so the result is the inverse - that is, Id' like to select all records except those where the FatherID = 0.

This is part of a Gossamer-Threads global.

I have tried, "ne" and "!=".

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] => Operator In reply to
Try something like;

Code:
my $sth = $tbl->select(['Full_Name'], { GT::SQL::Condition->new('FatherID','>','0') });

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] => Operator In reply to
Andy,
I tried that and it crashes the page:

Quote:
An error has occured. Please try again.
OK
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Any other suggestions?

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] => Operator In reply to
Not sure you want the {} round the condition statement.
Quote Reply
Re: [afinlr] => Operator In reply to
In Reply To:
Not sure you want the {} round the condition statement.

Beautiful. That fixed it. Thank you. Smile

Safe swoops
Sangiro