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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Nots within joins

Author  Topic 

Poddy88
Starting Member

26 Posts

Posted - 2009-02-21 : 12:51:34
Anybody got any idea how to i use this not statement within the joins, iv tried placing it in serval areas with nothing accomplished

where not server_tocab.Server_ID = 0

SELECT cabinet.cabinet_id, router_tocab.router_id
From cabinet
INNER JOIN server_tocab
on cabinet.server_id=server_tocab.Server_ID
INNER JOIN router_tocab
ON cabinet.router_id=router_tocab.router_id
order by cabinet.cabinet_id

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-21 : 12:54:02
Did you mean this?
SELECT cabinet.cabinet_id, router_tocab.router_id
From cabinet
INNER JOIN server_tocab
on cabinet.server_id=server_tocab.Server_ID
INNER JOIN router_tocab
ON cabinet.router_id=router_tocab.router_id
Where server_tocab.Server_ID <> 0
Order by cabinet.cabinet_id
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-21 : 12:54:54
Why duplicate?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=120295
Go to Top of Page

Poddy88
Starting Member

26 Posts

Posted - 2009-02-21 : 13:02:32
Yeh something like that but that line you have used

'Where server_tocab.Server_ID <> 0'

only selects all of the values which = 0 i want the opposite to select all the values not 0
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-21 : 14:36:16
quote:
Originally posted by Poddy88

Yeh something like that but that line you have used

'Where server_tocab.Server_ID <> 0'

only selects all of the values which = 0 i want the opposite to select all the values not 0



what happen when you run that?
Go to Top of Page

Poddy88
Starting Member

26 Posts

Posted - 2009-02-21 : 17:01:18
its ok iv sorted it thanks for your help, just chucked a not infront of where
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-22 : 00:56:20
quote:
Originally posted by Poddy88

its ok iv sorted it thanks for your help, just chucked a not infront of where


do you mean not (server_tocab.Server_ID <> 0)
but wont that still give you ones with 0?
Go to Top of Page
   

- Advertisement -