Reputation: 33
I am sybase adaptive server 12.5.4
and this query does not seem to run
SELECT login,account from tempdb.guest.acct_info_dr3
EXCEPT
SELECT login,account from tempdb.guest.acct_info_dr2
I have checked white spaces etc. But I keep getting this error Incorrect syntax near Except
.
Strangey MINUS which is oracle function worked.
Upvotes: 3
Views: 5780
Reputation: 1269603
You can always rephrase this as a left outer join
:
select dr3.login, dr3.account
from tempdb.guest.acct_info_dr3 left outer join
(select distinct login, account
from tempdb.guest.acct_info_dr2
) dr2
on dr2.login = dr3.login and dr2.account = dr3.account
where dr2.login is NULL
This will work, unless the columns contain NULL values. If so, that can be fixed with additional logic.
Upvotes: 4