SQL query to include supplier_num as 9285



IBM's flagship relational database management system

SQL query to include supplier_num as 9285

Postby bodhi » Mon Sep 17, 2007 8:48 pm

Select Char(D.UPC), A.Supplier_num, C. dept_num, Char(A.Supp_Location_code), Char(A.Decl_Avail_Qty) from
Tablename A, Tablename B, Tablename C, Tablename D
Where A.Supplier_num = b.supplier_num
And A.Part_id= B.Part_id
And D.Part_id= C.Part_id
And A.stroke_number = B.Stroke_number
And D.Prim_size_index = A.Prim_size_index
And D.sec_size_index = D.Sec_Size_index
And A.Colour_code= B.Colour_code
And B.Supp_location_code in (1,4,2,5)
And B.Supplier_num in (‘2080’,’2897’,’7658’………..)

In this query I want to include supplier_num as 9285 with supp_location_code as 3 and 6,

But problem is that if I include these 3 and as supp_location_code in above query it will fetch data for these supp_location_code for other suppliers also.

I need only 9285 with 3 and 6 location code and other suppliers with 1,2,4,5 location codes.If u can find then let me know.

Can anybody help in out...

Thanks in advance.
Bodhi
bodhi
 
Posts: 52
Joined: Mon Jul 30, 2007 5:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: qurey

Postby CICS Guy » Mon Sep 17, 2007 10:15 pm

Isn't there a way of joining two identical selects each having different where clauses?
CICS Guy
 
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: qurey

Postby dick scherrer » Fri Sep 21, 2007 5:42 am

Hello,

You might try something iike:
And ((B.Supp_location_code in (1,4,2,5)
And B.Supplier_num in (‘2080’,’2897’,’7658’………..))
or (B.Supp_location_code in (3,6)
And B.Supplier_num = '9285'))
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post