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 2000 Forums
 SQL Server Development (2000)
 minus - cant parse ?

Author  Topic 

andrewcw
Posting Yak Master

133 Posts

Posted - 2006-04-27 : 16:22:52
I have 2 tables - like this: My goal is to find what is new ( different in the first table

statlineNrTest
linenr
123
789

StatLineNrProced
123

I saw this query, but in my query pane in VS I get an odd error
(Unable to parse query text) before it will execute, and the result set is 123 not 789. Any ideas what could be the problem. ( SQL 2000)

SELECT linenr
FROM statlineNrTest minus
SELECT linenr
FROM StatLineNrProced

andrewcw

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-04-27 : 16:26:22
Minus isn't valid in SQL Server. What you need is LEFT OUTER JOIN.

This should do it:
SELECT t.linenr
FROM statlineNrTest t
LEFT OUTER JOIN StatLineNrProced p
ON t.linenr = p.linenr
WHERE p.linenr IS NULL

Tara Kizer
aka tduggan
Go to Top of Page

andrewcw
Posting Yak Master

133 Posts

Posted - 2006-04-27 : 16:33:32
Reply - Thank you for showing me how a left join will work !! - what then does the term intersect correspond to ??

andrewcw
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-04-27 : 16:38:41
Are you referring to the Intersect function in Analysis Services? Or are you referring to the different join types? If join types, start reading up on them in SQL Server Books Online. They are well documented in there.

Tara Kizer
aka tduggan
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-28 : 00:07:43
Also refer to here http://www.microsoft.com/technet/prodtechnol/sql/70/reskit/part11/sqc17.mspx?mfr=true




KH


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-28 : 01:41:10
Also read this
http://vyaskn.tripod.com/oracle_sql_server_differences_equivalents.htm

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -