mysql sub-select work around?

David A. Sinck plug-discuss@lists.plug.phoenix.az.us
Wed, 5 Feb 2003 11:03:58 -0700


\_ SMTP quoth az_pete@cactusfamily.com on 2/5/2003 09:18 as having spake thusly:
\_
\_ Hi Mike,
\_ I think this is what you're looking for.
\_ 
\_ 
\_ drop table if exists tmp_idt;
\_ 
\_ create temporary table tmp_idt
\_ SELECT (idt.unit * idt.price) AS Sub_Total
\_ FROM idt WHERE idt.myid = "1";
\_ 
\_ select sum(Sub_Total) as 'total' from tmp_idt;

Have we tried the good old

select sum(unit * price) from idt
where myid = 1
?

Seems to work ok for me on my tests.

David