Thanks Larry

That worked great,...

Is there a easy way to get rid of the cents do the display
shows  $10  instead of $10.00?  I can't fit all the columns
on the page.

Marc


----- Original Message ----- 
From: "Lawrence Lustig" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[email protected]>
Sent: Tuesday, February 01, 2005 9:39 AM
Subject: [RBG7-L] - Re: SQL select question


> > Is there a way to get the output to be on 1 line per Tr_date?
> > I want the output to look like this without using a view?
> >
> >   select tr_date,count(distinct custnum),$0.00,$0.00,$0.00,$0.00,$0.00 +
> >    from tran_hist where tr_type = 1  GROUP BY tr_date
> >   union +
> >   SELECT tr_date,0,SUM(ch_price)$0.00,$0.00,$0.00,$0.00 FROM tran_hist +
> >   WHERE tr_type = 1  GROUP BY tr_date +
> >   UNION +
> >   SELECT tr_date,0,$0.00,$0.00,SUM(ch_price)=s,$0.00,$0.00 FROM
tran_hist +
> >   WHERE ch_code = 'ipay'  GROUP BY tr_date  several more Unions ......
>
> Try this:
>
> SELECT TR_Date, +
>   SUM(IFEQ(TR_Type, 1, 1, 0)), +
>   SUM(IFEQ(TR_Type, 1, Ch_Price, 0)), +
>   SUM(IFEQ(CH_Code, 'ipay', Ch_Price, 0)), +
>   . . . More SUMs Here . . . +
>   FROM Tran_Hist GROUP BY TR_Date
>
> --
> Larry
>
>

Reply via email to