Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GroupBy expression not compliant with VFP
Message
 
To
12/03/2008 01:16:01
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01301191
Message ID:
01301222
Views:
13
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform