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:
00812031
Views:
12
This message has been marked as a message which has helped to the initial question of the thread.
>>>>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

I would jsut leave off the * and list the fields you want with the Upper function
select InvNum,Upper(name) as myname, SUM(qty) AS TOTALqty FROM test GROUP BY invnum,myName INTO cursor mycursor
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform