Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Client id which are link to any trading code


Client id which are link to any trading code

Author
Message
vijay.s
vijay.s
SSC-Enthusiastic
SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)

Group: General Forum Members
Points: 151 Visits: 359

Dear All
I have a problem, I have data like this


ID Product Product_code Status
19 EAI ZBC82 Active
19 EAI Z23V7 Inactive
16 DP 13598940 Active

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


Lowell
Lowell
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19389 Visits: 39468
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search