Omit Rows From Table

General
Fan

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

5 REPLIES
Senior Apprentice

Re: Omit Rows From Table

Based on your description this sounds like a simple Inner Join.

You should give more details, maybe some rows plus estimated result. 

Fan

Re: Omit Rows From Table

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

Enthusiast

Re: Omit Rows From Table

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,

Fan

Re: Omit Rows From Table

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

Enthusiast

Re: Omit Rows From Table

tcluster

Left Outer Join

sclusters

on t.code = s.code

where s.code is null

will give all strings not tagged to trading companies