473,513 Members | 2,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"... WHERE (a, b) != (1,2) AND (a,b) != (1,3) ..."


Hi.

I would like to retrieve all records from a table except these where
the (a, b) combination has one of a series of specific values. For
example, in MySQL I can given the table:

a b
1 2
1 3
3 4

Do:

SELECT a, b
FROM tbl
WHERE (a, b) != (1,2) AND (a, b) != (3,4)

And get result:

1 3

Whats the DB2 equivalent?

Thanks.

Morten

Aug 11 '06 #1
3 1085
us****@kikobu.com wrote:
>
Hi.

I would like to retrieve all records from a table except these where
the (a, b) combination has one of a series of specific values. For
example, in MySQL I can given the table:

a b
1 2
1 3
3 4

Do:

SELECT a, b
FROM tbl
WHERE (a, b) != (1,2) AND (a, b) != (3,4)

And get result:

1 3

Whats the DB2 equivalent?
DB2 only supports the equality comparison:
http://publib.boulder.ibm.com/infoce...n/r0000747.htm

So you'll have to simply transform the above predicate.

NOT ( (a, b) = (1, 2) OR (a, b) = (3, 4) )

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Aug 11 '06 #2
us****@kikobu.com wrote:
Hi.

I would like to retrieve all records from a table except these where
the (a, b) combination has one of a series of specific values. For
example, in MySQL I can given the table:

a b
1 2
1 3
3 4

Do:

SELECT a, b
FROM tbl
WHERE (a, b) != (1,2) AND (a, b) != (3,4)

And get result:

1 3

Whats the DB2 equivalent?

Thanks.

Morten
The DB2 equivalent, actually, the SQL equivalent, is to use IN.

In DB2 style (because of the VALUES clause) it becomes:

SELECT a, b
FROM tbl
WHERE (a, b) NOT IN (VALUES(1,2), (3,4))

B.

Aug 11 '06 #3
Knut Stolze wrote:
us****@kikobu.com wrote:
>Hi.

I would like to retrieve all records from a table except these where
the (a, b) combination has one of a series of specific values. For
example, in MySQL I can given the table:

a b
1 2
1 3
3 4

Do:

SELECT a, b
FROM tbl
WHERE (a, b) != (1,2) AND (a, b) != (3,4)

And get result:

1 3

Whats the DB2 equivalent?

DB2 only supports the equality comparison:
http://publib.boulder.ibm.com/infoce...n/r0000747.htm

So you'll have to simply transform the above predicate.

NOT ( (a, b) = (1, 2) OR (a, b) = (3, 4) )
or use the [NOT] IN predicate
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
5042
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
1
8050
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that starts with a particular sub-string This works as...
2
20481
by: Eric Osman | last post by:
Hi, I'm looking for a javascript function that will convert input such as this: <CLUB Code=" into this: &lt;CLUB Code=&quot;
3
3623
by: NecroJoe | last post by:
I am using PHP to generate a little javascript for one of my pages. In short it allows a user to select a value from a list and pop it into a form field on a seperate page. This works well unless...
5
3436
by: Mateusz Loskot | last post by:
Hi, I'd like to ask how XML parsers should handle attributes which consists of &quot; entity as value. I know XML allows to use both: single and double quotes as attribute value terminator. That's...
3
2690
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
5
3422
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot;...
8
3606
by: Ulysse | last post by:
Hello, I need to clean the string like this : string = """ bonne mentalit&eacute; mec!:) \n <br>bon pour info moi je suis un serial posteur arceleur dictateur ^^* \n ...
1
2829
by: manchin2 | last post by:
Hi, Can anybody please provide the information about "&quot" and its use, if possible please provide an example. ...
4
3872
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7162
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5090
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3223
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.