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 |
|
dynamorevy
Starting Member
6 Posts |
Posted - 2006-12-01 : 03:30:03
|
| Many thanks in advance for anyone that can help me write this qry:To summarise - we have a database that links components to services. Components can have a 1 to many relationship with services. The components are held in a table:dbo.componentscompID compName compType1 srv1 12 srv2 13 srv3 1We also have a services table which hold all our various services we own:dbo.servicessvcID svcName1052 svc11053 svc21054 svc3We then have a tbl that shows the links between components and servicesdbo.compUsessvcID compID1052 3101052 4001053 1221256 134I would like to find out through the qry what components are currently NOT linked to a service. This will allow me to find out what components have no relationships. This is in SQL2005.Have I explained this well enough? Any help would be much appreciated! |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-12-01 : 03:40:13
|
| [code]Select c.CompID, c.CompName, c.CompTypefrom components cLEFT JOIN compUses uon c.compID = u.compIDWhere u.compID Is NULL[/code]Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|