Source language: Translate to:

Combine operators

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Combine operators

Postby David de Argentina » Tue Dec 13, 2011 10:26 am

Hi all,

I need get some records in a table according this clause:

the State value must be distinct to "WA", "TX" and "CA"

I tryed this dbpQuery:

"State = NOT IN ('WA', 'TX', 'CA')"

and

"NOT State = IN ('WA', 'TX', 'CA')"

In both cases, i gave an error.

Any ideas ?

Thanks in advance,

David de Argentina
User avatar
David de Argentina
 
Posts: 1560
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby smartmedia » Tue Dec 13, 2011 11:11 am

Hi..

Why you don't just use OR operator..??? The field keeps WA, TX, CA keep other data also..???

Try something like that:
SELECT * FROM Table WHERE State ='WA' OR State = 'TX' OR State ='CA';

If you want to get distinct records just use this

SELECT DISTINCT * FROM Table WHERE State ='WA' OR State = 'TX' OR State ='CA';
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby David de Argentina » Tue Dec 13, 2011 11:22 am

Thanks Smartmedia,

I need do this using dbpQuery, not dbpExecSQL.

If i do:

dbpQuery "DB" "Table" "State = IN ('WA', 'TX', 'CA')"

the result is ok, works fine.

Problem is when i combine both operators IN & NOT.

I think there are a way to do this.

Thanks again,

David de Argentina
User avatar
David de Argentina
 
Posts: 1560
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby Neosoft Support » Tue Dec 13, 2011 11:35 am

I think you do not need the equals sign. Try this:

dbpQuery "DB" "Table" "State IN ('WA', 'TX', 'CA')"

or

dbpQuery "DB" "Table" "State NOT IN ('WA', 'TX', 'CA')"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby David de Argentina » Tue Dec 13, 2011 12:23 pm

Thanks Dave, works fine.
User avatar
David de Argentina
 
Posts: 1560
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest

cron