Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with TOP and UNION
Message
 
 
À
27/12/2004 11:53:31
John Deupree
Long Term Care Authority
Tulsa, Oklahoma, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00972363
Message ID:
00972380
Vues:
17
You're welcome. Sorry for incorrect original suggestion. I didn't notice that it was for MS SQL server, not for VFP.

>Works like a champ!
>
>Thanks
>
>>Try (not tested)
SELECT plan, begindate
>>	FROM mytable
>>	WHERE begindate IN (
>>		SELECT TOP 2 begindate
>>		FROM mytable
>>		ORDER BY begindate DESC)
>>UNION ALL
>>	SELECT MAX(plan) + 1, CAST(Null AS D)
>>	FROM mytable
>>ORDER BY begindate DESC
>>
>>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform