469,280 Members | 2,053 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,280 developers. It's quick & easy.

SQL QUERY

Hi; I need some help in writing a query and the following is what I am
trying to do.

SELECT VALUE_ID
FROM CC000.VVALIDITYVALUE
WHERE (CATEGORY_ID = 2)

The above Query will give will every Value_ID where the Category_ID =2.
Then

SELECT VALUE_ID
FROM CC000.VSCREENVALUE
WHERE (SCREEN_ID = 'CCL100') AND (CATEGORY_ID = 2)

The above one will give me all Value_ID where the Screen_ID = 'CCL100'
AND Category_ID = 2. Now, what I really want is every Value_ID from the
First Query except the ones from the Second Query.

So, Please help me out

Thanks
Binu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 2472
Try this one:

SELECT VALUE_ID
FROM CC000.VVALIDITYVALUE T1
WHERE (CATEGORY_ID = 2)
AND NOT EXISTS ( SELECT *
FROM CC000.VSCREENVALUE T2
WHERE (SCREEN_ID = 'CCL100')
AND (CATEGORY_ID = 2)
AND T1.VALUE_ID = T2.VALUE_ID )

"Binu Jacob" <bj*******@msn.com> schreef in bericht
news:3f*********************@news.frii.net...
Hi; I need some help in writing a query and the following is what I am
trying to do.

SELECT VALUE_ID
FROM CC000.VVALIDITYVALUE
WHERE (CATEGORY_ID = 2)

The above Query will give will every Value_ID where the Category_ID =2.
Then

SELECT VALUE_ID
FROM CC000.VSCREENVALUE
WHERE (SCREEN_ID = 'CCL100') AND (CATEGORY_ID = 2)

The above one will give me all Value_ID where the Screen_ID = 'CCL100'
AND Category_ID = 2. Now, what I really want is every Value_ID from the
First Query except the ones from the Second Query.

So, Please help me out

Thanks
Binu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by jaysonsch | last post: by
9 posts views Thread by netpurpose | last post: by
3 posts views Thread by Harvey | last post: by
4 posts views Thread by Diamondback | last post: by
14 posts views Thread by Dave Thomas | last post: by
4 posts views Thread by Stan | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.