Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IS this Possible??
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00859760
Message ID:
00859867
Views:
16
You're welcome.

>Sergy,
>
>Thank you very much for this info, it did the trick!
>
>
>
>>Hi Bob,
>>
>>If you've to reuse result of the first query, you can store it into temporary table or table variable. Otherwise, you can include the first query as subquery in the second one.
-- Temp table
>>SELECT Acctnum
>>	INTO #temp01
>>	FROM Checks
>>	WHERE Checks.TYPE = '1'
>>
>>SELECT Acctnum FROM #temp01
>>UNION
>>SELECT Acctnum FROM Checks
>>	WHERE Acctnum NOT IN (SELECT Acctnum FROM #temp01)
>>DROP TABLE #temp01
>>--
>>
>>SELECT Acctnum FROM Checks
>>	WHERE Acctnum NOT IN (
>>		SELECT Acctnum FROM Checks
>>			WHERE Checks.TYPE = '1' )
>>
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform