|
Posted by Pradeep on 10/19/06 01:10
Wonderful. This solved the problem.
Thank you very much for your help.
Pradeep
Kart wrote:
> select 'Color' = CASE
> WHEN Sum(ActualSales - ForecastSales) > 0 THEN 'Green'
> Else 'Red'
> END
> from <TableName>
>
> Pradeep wrote:
> > Hello,
> >
> > In my table, I have two columns - ForecastSales and ActualSales. I need
> > to write a query that returns me just one aggregate value (one row and
> > one column). If sum(ActualSales - ForecastSales) is negative, I need to
> > return "red." Otherwise, I need to return green.
> >
> > I looked at CASE statement. However, I could not figure out an
> > efficient way to build this query. I would appreciate your help.
> >
> > Thank you in advance for your help.
> >
> > Pradeep
Navigation:
[Reply to this message]
|