Friday, November 11, 2011

How to only select fields in one sql table that exist in another sql table

Use the following sql statement to compare tables:


SELECT * FROM table1 WHERE EXISTS (SELECT * FROM table2 WHERE table2.commonvariable = table1.commonvariable)

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Web Design & Marketing - Click and get an instant quote on your project