Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GroupBy expression not compliant with VFP
Message
 
À
12/03/2008 01:16:01
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01301191
Message ID:
01301222
Vues:
12
>>Try this in VFP, can't test SQL at present.
>>
>>SELECT Client.AI,RTRIM(Client.Name)+' ('+RTRIM(Client.Code)+')' AS Clientxxx
>> FROM Client
>> GROUP BY Client.AI,clientxxx
>>
>
>This is not compliant in SQL Server.
-- T-SQL
DECLARE @Client TABLE (AI int ,Name varchar(200), Code char(6))

SELECT Ai, Clientxxx, MAX(Code) AS Code
FROM (SELECT Client.AI,RTRIM(Client.Name)+' ('+RTRIM(Client.Code)+')' AS Clientxxx, Code
             FROM @Client Client) Tbl1
GROUP BY AI,Clientxxx


*** VFP
CREATE CURSOR Client (AI int ,Name varchar(200), Code char(6))

SELECT Ai, Clientxxx, MAX(Code) AS Code;
FROM (SELECT Client.AI,RTRIM(Client.Name)+' ('+RTRIM(Client.Code)+')' AS Clientxxx, Code;
             FROM Client) Tbl1;
GROUP BY AI,Clientxxx
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform