![]() Equipping You to Communicate Effectively | support CMN & share a library of 19K+ images, videos, etc Go Pro! |
![]() | ![]() |
| |||||||
| Website Coding Discussions PHP, MySQL, Java, Javascript, ASP, etc. |
![]() |
| | Thread Tools | Search this Thread | Rate Thread | Display Modes |
| ||||
| I get to work with MS SQL Server rather than MySQL, but you want something along the lines of: Code: select table1.name from table1 where table1.name not in (select table2.name from table2) and table1.name not in (select table3.name from table3) |
| The Following User Says Thank You to hussra For This Useful Post: | ||
danroth (Thursday, June 19th, 2008) | ||
| ||||
| Quote:
Something vaguely like this? Code: select table1.name from table1 left outer join table2 on table1.name = table2.name left outer join table3 on table1.name = table3.name where table2.name is null and table3.name is null |
| The Following User Says Thank You to hussra For This Useful Post: | ||
danroth (Thursday, June 19th, 2008) | ||
| ||||
| Yep, the left join on the null condition is the way to do it. "outer" is optional; by default a left join is a left outer join. You're looking to, for example, return the list of people who own property in Dallas County (table1) but do not own property in either Collin or Tarrant counties, something like that? |
| The Following User Says Thank You to waynehoskins For This Useful Post: | ||
danroth (Thursday, June 19th, 2008) | ||
| ||||
| Assuming the different database is at least on the same server... you can then just use db_name.table_name and db_name.table_name.column_name in place of table_name and table_name.column_name. |
| The Following User Says Thank You to hussra For This Useful Post: | ||
danroth (Thursday, June 19th, 2008) | ||