Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Distinct in Case clause - response (2) by dmenzaghi

$
0
0

Yes for sure.
I use a more realistic sample to explain.
 
My starting table:

Sales_Trx_Id

Gross_Sales_Amt

Item_Qty

Item_Division_Cd

Sales_Trx_Tm

710566684

002

001

24

17:56:19

711879367

001

001

24

16:42:03

711879367

002

001

24

16:42:03

713314337

001

001

24

18:20:50

 The code in the query:
 ..
case when ( Sales_Trx_Tm time '12:00:00' then 1
else 0 end) as fascia_1,
case when ( Sales_Trx_Tm>= time '12:00:00' then 1
else 0 end) as fascia_2
from table
group by sales_trx_id
 
 When group by sales_trx_id i want that for value 711879367 i have fascia_2=1.
So i need to evaluate just 1 time the value 16:42:03.
Is it clear now?
Thanks
 
 
 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>