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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select records problem

Author  Topic 

zubair
Yak Posting Veteran

67 Posts

Posted - 2009-10-07 : 08:47:51
HI i have a select statement like follows:

select ip, arrival_time
from clicky_recent_visitors
where id = 1

No i want to exclude records from the above query that exist in another table. This is what i am doing with the ips hardcoded

select ip, arrival_time
from clicky_recent_visitors
where id = 1
and ip_address not in ('83.1.57.93','80.187.109.155')

I thought something like this might work..

select ip, arrival_time
from clicky_recent_visitors
where id = 1
and ip_address not in (select ip from clicky_following)

However this does not work.....

Can anyone help me?

Thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-07 : 08:57:45
Any error messages or is your output ...this does not work...?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

zubair
Yak Posting Veteran

67 Posts

Posted - 2009-10-07 : 09:37:35
i get no error messages but the records are not removed from the first query
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-07 : 09:45:36
So it is possible that clicky_recent_visitors.ip_address not equal to clicky_following.ip.
They might differ in case of spaces or leading zeroes or so...
Have a look at certain values to see what makes the difference.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -