Re: SQL QUERY

Re: SQL QUERY

 

  

Hi Again,

I tried below Query:

select s# from parts_suppliers group by s# having count(p#)=(select
count(p.p#) from parts p)

I got correct output.

Please suggest if there is any alternative method of doing this.

Thanks




"sepiagupta" <db2udbdba-ezmlmshield-x49509342.[Email address protected]
12/29/2005 10:07 PM
Mail Size: 4922

To
"LazyDBA Discussion" <[Email address protected]
cc

Subject
SQL QUERY
Our Ref

Your Ref







HI All,

I have three tables Parts,Suppliers, parts_suppliers.

Parts

P# PNAME
---------- ----------
p1 part1
p2 part2
p3 part3

Suppliers

S# SNAME
---------- ----------
s1 supp1
s2 supp2
s3 supp3

parts_suppliers

S# P#
---------- ----------
s1 p1
s1 p2
s2 p1
s1 p3

I want all the supplier's number who is selling every part that is present

in parts table.

Thus for the data above my output should be s1.

I don't know how to write that query. Can anybody please suggest the
query?

Many Thanks,



************************************************************
HSBC Software Development (India) Pvt Ltd
HSBC Center Riverside,West Avenue ,
25 B Kalyani Nagar Pune 411 006 INDIA

Telephone: +91 20 26683000
Fax: +91 20 26681030
************************************************************



-----------------------------------------
***********************************************************************
This e-mail is confidential. It may also be legally privileged.
If you are not the addressee you may not copy, forward, disclose
or use any part of it. If you have received this message in error,
please delete it and all copies from your system and notify the
sender immediately by return e-mail.

Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability
for any errors or omissions.
***********************************************************************


---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html


-----------------------------------------
******************************************************************
This message originated from the Internet. Its originator may or may
not be who they claim to be and the information contained in the
message and any attachments may or may not be accurate.
******************************************************************




************************************************************
HSBC Software Development (India) Pvt Ltd
HSBC Center Riverside,West Avenue ,
25 B Kalyani Nagar Pune 411 006 INDIA

Telephone: +91 20 26683000
Fax: +91 20 26681030
************************************************************

DB2 & UDB email list listserv db2-l LazyDBA home page