Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do 2 selects match?
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00947744
Message ID:
00947748
Views:
15
Mike,

Try
SELECT * 
	FROM mytable mt1
	FULL OUTER JOIN mytable mt2 
		ON mt1.FldName = mt2.FldName
	WHERE mt1.ItemCode = 1 
		AND mt2.ItemCode = 2 	
		AND ( mt1.FldName IS NULL OR mt2.FldName IS NULL)
>I have a table like this:
>
>
>ItemCode   FldName
>--------   -------
>1          John
>1          George
>1          Ringo
>2          John
>2          Ringo
>2          Paul
>3          Bill
>3          Bob
>...
>
>
>I would like to determin if there is ANY FldName with ItemCode 1 that does NOT have a matching FldName in item 2 - AND VICE VERSA.
>
>I was thinking of doing a SELECT FOR NOT IN - but I think I would have to do two statements to get the whole story. I suppose I could do some sort of an outer join, but I'm a bit baffled about how to do it in one step.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform