SQL Help

Archived from the original Sajha.com — preserved as posted, replies can no longer be added here.
Start a New Discussion
Archived Post

Please help me. I have two tables. First table has rows with some colums Second table has rows with same colums and some other columns I need to get rows that exist in table one but not in table two. Please see the picture I could not upload picture Last edited: 15-Jan-14 01:33 PM

NepaliBhai · Jan 15, 2014 1:32 PM · 16,056 views

5 Replies

http://www.techonthenet.com/sq... Please review the following link. This might help you for future reference too.

DEVN · Jan 15, 2014 2:22 PM

This really depends on the Relation between two tables. This could be the syntax for two tables containing same column say student_Id. select * from table one where tableone.student_Id NOT IN ( Select tabletwo.student_ID from table two) ;

mvc · Jan 15, 2014 2:29 PM

Left Join

Nayayana · Jan 15, 2014 3:31 PM

mvc, That's not the proper way to do it. I know it works. But SQL query is not optimized in that Sub-query............... Here it is Select [Column lists...............] FROM table1 a LEFT JOIN table2 b ON a.SameColumnName = b.SameColumnName WHERE b.SameColumnName IS NULL

STUPIDA · Jan 15, 2014 3:34 PM

Thank you all.

NepaliBhai · Jan 15, 2014 3:53 PM

This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.

Start a New Discussion