 |
 |
Archives of the TeradataForum
Message Posted: Mon, 22 Oct 2002 @ 00:35:12 GMT
Subj: | | Distinct Count with case statement |
|
From: | | Dev a p |
Hi,
I have a question. Appereciate your help. SQL needs distinct count with
different column as per case statement conditions.
Table data :
Source Col1 Col2 Col3
Plant1 x1
Plant1 x2
Plant2 x1 y1
Plant2 x1 y1
Plant2 x2 y2
SQL ????????
Select Source ,
distinct count ( Case When Source = 'Plant1' Then Col1
When Source = 'Plant2' Then (Col2 || col3) End )
Result should be :
Source Count
Plant1 2
Plant2 2
Could you please help me to put the sql code.
Thanks,
| |