Do the CASE in a nested table expression (NTE) and then do the group by on
the outer SELECT.
e.g.
SELECT nte.col
FROM (
SELECT CASE when code = b then COL1
else then COL2
END as col
FROM
etc.)
) as nte
GROUP BY nte.col
Double check the syntax but this should be close.
HTH,
Tim
> -----Original Message-----
> From: Amir Sadeghi [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 8:50 AM
> To: [EMAIL PROTECTED]
> Subject: DB2EUG: SQL Question: GROUP BY columns without names
>
> Hi team,
>
> I am trying to do a GROUP BY on column that has no name. As far as I know
> I
> cannot use numbers the same way I can with ORDER BY, for example ORDER BY
> 1,2, etc.
>
> Here is an example of the column I am trying to group by:
> .....
> CASE When code=b Then COL1
> Else COL2
> ....
>
>
> Any ideas? I even tried to name the column with SELECT...AS "NEW_NAME"
> and
> GROUPed BY this name but I got an error.
>
>
>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> =====
> To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
> For other info (and scripts), see
> http://people.mn.mediaone.net/scottrmcleod
=====
To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
For other info (and scripts), see http://people.mn.mediaone.net/scottrmcleod