0

Hello Experts,

I have following tables:

Table_1:

C_ID Inst_No Paid_Dt
201 2 12/06/2010
202 2 13/06/2010
203 3 12/06/2010
202 3 16/06/2010


Table_2:

C_ID Inst_No Today_Dt
201 2 12/06/2010
202 2 12/06/2010
203 3 12/06/2010
202 3 16/06/2010


Now, from the above two tables I want to display only the records where Paid_Dt and Today_Dt are not equal.

Like the Result should be
202 2 12/06/2010

I tried it by inner join and <> (Not Equal operator) but, it shows all data instead of a particular.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Sinha's
1

Hello,

What you need to do is to select your records and do the join with the C_ID and Inst_No and then use the WHERE to select a subset of the data where the fields are not equal. Something like:

SELECT Table_1.C_ID, 
Table_1.Inst_No,  
Table_1.Paid_Dt, 
Table_2.C_ID 
Table_2.Inst_No 
Table_2.Today_Dt
From Table_1 Inner Join Table_2 on Table_1.C_ID = Table_2.C_ID 
AND
Table_1.Inst_No = Table_2.Inst_No
WHERE 
Table_1.Paid_Dt <> Table_2.Today_Dt
0

Thanks a lot, My problem is solved. Now I am getting the result what i was looking for.

Regards!!

Hello,

What you need to do is to select your records and do the join with the C_ID and Inst_No and then use the WHERE to select a subset of the data where the fields are not equal. Something like:

SELECT Table_1.C_ID, 
Table_1.Inst_No,  
Table_1.Paid_Dt, 
Table_2.C_ID 
Table_2.Inst_No 
Table_2.Today_Dt
From Table_1 Inner Join Table_2 on Table_1.C_ID = Table_2.C_ID 
AND
Table_1.Inst_No = Table_2.Inst_No
WHERE 
Table_1.Paid_Dt <> Table_2.Today_Dt
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.