Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IS this Possible??
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00859760
Message ID:
00859858
Vues:
13
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' )
>
>
>>Hi Sergy,
>>
>>I Wayyy over simplified that... So I should not have done
>>that... Sorry...
>>
>>The 1st Table pulls out the Account Number information based
>>on the checking of 2 Tables, of about 241 million records...
>>The 2nd Query, I want to pull out the Account #'s that are not
>>in the First Query..
>>
>>So I should have asked, how do I Select Records that are not
>>in a Select Statement that has just been run and returned
>>a result set somewhere...
>>
>>Sorry about that...
>>Thanx!
>>Bob
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform