Posted by Cerebral Believer on 10/14/20 11:58
"NC" <nc@iname.com> wrote in message
news:1158443426.110452.211810@e3g2000cwe.googlegroups.com...
> Cerebral Believer wrote:
>>
>> I have the following statement:
>>
>> SELECT SUM(`Quantity Ordered`)
>> FROM `Sales Detail Information` WHERE
>> `Catalogue Number` = "FBDCD008";
>>
>> I can run this as a query in the SQL window, and it works fine.
>>
>> How could I turn this query into a FUNCTION or perhaps
>> better still a PROCEEDURE? I am not sure if FUNCTIONS
>> can reference tables...
>
> Read MySQL documentation:
>
> http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
Thanks, I keep getting Error #1064, but the same syntax works fine for a
simple query.
CREATE FUNCTION Sum_001R RETURNS INT
SELECT SUM(`Quantity Ordered`) FROM `Sales Detail Information`
WHERE`Catalogue Number` = "FBDCD008";
I am perplexed.
Regards,
C.B.
[Back to original message]
|