Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
parallon
Starting Member
25 Posts |
Posted - 2006-05-16 : 12:17:13
|
Hello all. I have two tables (Equipment and Divisions). The Divisions table contains all valid division codes, and the Equipment table has the equipment numbers along with the corresponding division code. The problem is that many of the equipment were put in throught the back-end, therefore no error checking took place. What I need to do is to create a query that will go through the Equipment table and find any Divisions that do not exist in the Divisions table. I have tried various joins, Union, etc, but I can't seem to figure it out.Any help would be greatly appreciated,Parallon |
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-16 : 13:59:52
|
Give some sample data and expected resultsSrinika |
 |
|
parallon
Starting Member
25 Posts |
Posted - 2006-05-16 : 14:11:14
|
Actually, I finally got it with a sub-query. Didn't know this was possible.SELECT Equipment, EquipmentDesc, DivisionFROM EquipmentWHERE Division NOT IN (SELECT flddivision FROM tblDivision)Thank you for your time anyway,Parallon |
 |
|
|
|
|