Re: SQL help
Posted in 1998
Douglas Wilson — — source: Informix-list mailing list archive (1991-1998)
Rick Walrath wrote: > > I am a v5.1 trying to run a query that will contain a subquery utilizing the > sum(field) function. It goes a little something like this... > > select > cust_name, > (select sum(sold_amt) from invoices > where MONTH(inv_date)=1 and YEAR(inv_date)=1998), > (select sum(profit_amt) from invoices > where MONTH(inv_date)=1 and YEAR(inv_date)=1998)) > from > invoices > group by 1 try: select cust_name, sum(sold_amt), sum(profit_amt) from invoices where MONTH(inv_date)=1 and YEAR(inv_date)=1998 group by 1 Hope that helps, Douglas Wilson