If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Rewriting QUery

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-26-04, 17:03
ppapas_98 ppapas_98 is offline
Registered User
 
Join Date: Apr 2004
Posts: 1
Unhappy Need Help Rewriting QUery

My problem is that I have to rewrite the following query using COUNT and GROUP BY and get the same results. The Query lists the name of customers in a database such that all parts they buy are made by suppliers in "Germany"
the query goes as:
SELECT C_NAME
FROM CUSTOMER
WHERE NOT EXISTS (SELECT L_PARTKEY
FROM ORDER LINEITEM PARTSUPP SUPPLIER
WHERE O_CUSTKEY = C_CUSTKEY
AND O_ORDERKEY = L_ORDERKEY
AND L_PARTKEY = PS_PARTKEY
AND PS_SUPKEY = S_SUPKEY
AND S_NATIONKEY NOT IN (SELECT N_NATIONKEY
FROM NATION
WHERE _NAME = ``GERMANY''))

please any help how to rewrite the above using COUNT and GROUP BY will VERYVERY appreciate Thanks

Last edited by ppapas_98; 04-27-04 at 12:35.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On