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
 not equal joins

Author  Topic 

gdimov
Starting Member

2 Posts

Posted - 2007-01-23 : 08:13:38
Hi,

I need to select all database names that are not contained in table tsm.dbo.DB_NOT_to_Backup, but are present in master..sysdatabases.
Can this be done using not equal joins?

I tried the query below, but it got me nowehere:

select a.name
from master..sysdatabases a inner join tsm.dbo.DB_NOT_to_Backup c on a.name<>c.DBname
order by a.name

G

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-23 : 08:16:25
[code]
select a.name
from master..sysdatabases a
left join tsm.dbo.DB_NOT_to_Backup c
on a.name = c.DBname
where c.name is null
[/code]


KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-23 : 08:17:35
select a.name
from master..sysdatabases a
LEFT join tsm.dbo.DB_NOT_to_Backup c on c.DBname = a.name
where c.dbname is null
order by a.name


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

gdimov
Starting Member

2 Posts

Posted - 2007-01-23 : 08:26:21
thanks for all of you guys
Go to Top of Page
   

- Advertisement -