All Forums General
ShyMuk 3 posts Joined 11/13
15 Jan 2014
Omit Rows From Table

Hello All,
My query is as follows:
I have 2 Tables, Table A is TCLUSTERS and Table B is SCLUSTERS.
Columns in Table A - T_Code, T_Description & in Table B - S_Code & S_Description.
All I have to do is display only those rows from Table B which have S_Code mapping to T_Code from Table A i.e. all S must have a T. If S do not have a T, then they have to be omitted. What is the logic I should use in my SQL to display the same.
Hope I was able to explain what I am looking for?
Thanks in advance,
SM
 

dnoeth 4628 posts Joined 11/04
15 Jan 2014

Based on your description this sounds like a simple Inner Join.
You should give more details, maybe some rows plus estimated result. 

Dieter

ShyMuk 3 posts Joined 11/13
15 Jan 2014

Thanks for the prompt reply Dieter.
The logic is this.. TCLUSTERS has all the information about TRADING Companies, while SCLUSTERS holds all the STRINGS. Each String should have a Trading Company. The total rows is about 8000 (small table). But there are only a few strings that do not have TRADING Companies and these should be filtered out from the Result. What is the logic here?
 
Thanks again
SM

Raja_KT 1246 posts Joined 07/09
16 Jan 2014

Hi ShyMuk,
It is difficult without proper info. If you are just looking for logic, then :
It sounds like  a minus operation, set theory. But before using , since data have to be matched to the same  type and numbers, then you need to do some operations to brin to the same platform,  before you operate. A MINUS B.
Does it help?
Cheers,

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

ShyMuk 3 posts Joined 11/13
16 Jan 2014

Hello Raja,
Thanks a ton for your reply. I only saw your reply now... guess will try it at work tomorrow. I will try and implement and will keep you informed.
Cheers,
SM
 
 

TD_Raj 50 posts Joined 05/10
22 Jan 2014

tcluster
Left Outer Join
sclusters
on t.code = s.code
where s.code is null
will give all strings not tagged to trading companies 

You must sign in to leave a comment.