Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select and Total
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00811985
Message ID:
00812026
Views:
13
>>>SELECT invnum, name, SUM(qty) AS qty FROM table GROUP BY Invnum+Name INTO cursor cursorname
>>
>>This give me the folowing error:
>>"SQL: GROUP BY clause is invalid."
>>
>>It appears that I can not use more than one field in the group by clause. Is this correct?
>>
>>Einar
>
>Try a comma instead of a plus. My bad..
No problem. I've got another question that you might be able to answer. I don't seem to be able to use the upper() function on a field contained in the group by clause.

Example:
This is the starting table
invnum  name  qty
------  ----  ---
001     AA      2
001     AA      1
001     Aa      4
after doing my SQL select I would like to have the folowing cursor:
invnum  name  qty
------  ----  ---
001     AA      7
Is the best solution the folowing SQL select statement:
select *,Upper(name) as myname, SUM(qty) AS TOTALqty FROM myTable GROUP BY invnum,myName INTO cursor mycursor where invnum =="001"
It seems to work.

Thanks,
Einar
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform