sql make inverse of a select

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
db mysql 4.x

nn ss zz
14 1  2
14 1  5
15 1  2
15 1  6
16 1  2
16 1  5
26 1  2
26 0  9

WHERE ss=1 AND zz=5   and I have:

how can change code for to have all the other number? this:

Re: sql make inverse of a select

artev wrote:

Quoted text here. Click to load it

Well, going by the statement you use now, all of the 'nn' numbers have a
'zz' value of '2', so: SELECT nn FROM tab WHERE ss=1 AND zz=2  would
get you 14, 15, 16 and 26.  Of course, that might not ultimately work
for all of your data, and it probably depends on your script and the
rest of the logic.  Also, you probably want to ask this in the MySQL
group and/or the group of the language you run this statement in (if
you're not just using a command line and mysql itself -- which is fine,
if that's what you're doing).
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!

Site Timeline