January 20, 2009 at 7:18 am
[font="Courier New"]
Dear All
I have a problem, I have data like this
ID Product Product_code Status
19 EAI ZBC82 Active
19 EAI Z23V7Inactive
16 DP 13598940Active
Now I want to select record in this format for check whether all such DP Product code id have any Active trading code in same id.
Client ID Trading_Code Status
13598940 ZBC82 Active
[/font]
January 20, 2009 at 8:14 am
in general, you'll see two ways to do this.
you can use a
SELECT * FROM TABLE1 WHERE [Client ID] in (SELECT [Client ID] FROM TABLE2 WHERE Trading_Code IN('ZBwhatever') )
or you can left outer join the table
SELECT * FROM TABLE1
LEFT OUTER JOIN TABLE2 ON TABLE1.[Client ID]=TABLE1.[Client ID]
WHERE WHERE TABLE2 .Trading_Code IN('ZBwhatever')
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply