>Then you need something like your original query, but you need to join
>the subquery to the main query, but I think I'd do it this way
>(you can add profit_amt yourself):
>
>select
>cust_name,
>(select sum(sold_amt) from invoices t2
>where MONTH(inv_date)=1 and YEAR(inv_date)=1998
>and t1.cust_name=t2.cust_name),
>sum(sold_amt)
>where YEAR(inv_date)=1998
>from
>invoices t1
>group by 1
>
>
>Hope that helps,
>Douglas Wilson
That looks like exactly what I need, however, I am not familiar with the t1
and t2 arguments. Are they temporary table designations? I tried the above
suggestions but I received the following error {Error -217 during prepare:
Column (%s) not found in any table in the query. }
I think SQL was looking for a table NAMED invoicest1, which, obviously,
there isn't.
Do I have some bad syntax?
I replaced the "t1.cust_name" with "1 cust_name" (no period) and received a
syntax error.
I think I am getting really close, with your help.
Thanks
Rick W