Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Selecting data where column not equal?

Quote Reply
Selecting data where column not equal?
Hi there Smile,I am using the following statement to pull some data from the database:
Code:
my $sth = $DB->table('mytable')->select({owner => $USER->{Username}, id => $rowID } );

My delema is that I don't want the rows 'where id = $rowID',
I want the rows 'where id != $rowID'.

I have searched through the forums and read through the documentation, but all I found was
information about 'larger than'('id-gt => $rowID') and 'less than'('id-lt => $rowID').


Sacrifice is not about what you lose,
it is about what you gain in the process.
Quote Reply
Re: [EZFrag] Selecting data where column not equal? In reply to
Hi,

This should work:

Code:
my $sth = $DB->table('mytable')->select( GT::SQL::Condition->new('owner','=',$USER->{Username},'id','!=',$rowID) );

Hope that helps =)

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] Selecting data where column not equal? In reply to
Yes, that worked.
Thank you Andy Smile


Sacrifice is not about what you lose,
it is about what you gain in the process.