|
Archives of the TeradataForumMessage Posted: Tue, 24 Sep 2002 @ 18:47:15 GMT
Is this possible? I'm trying to figure out how to do a count(distinct) to get a unique count of account numbers that fit the case criteria below. I can get the sum(case... logic to work fine but this only gives me record counts and not a distinct count of account numbers. the statement below counts recs (this works fine but I need the distinct count of acct_id): ------------------------------------------------------------------------ sum(case when orgnl_srv_dt >= '2002-05-08' and elec_addr_txt <> ' ' then 1 else 0 end) as count1 I was trying to get the below to count the distinct account numbers: -------------------------------------------------------------------- count(distinct(case when orgnl_srv_dt >= '2002-05-08' and elec_addr_txt <> ' ' then b.acct_id else null end)) as count1, The error code for the above is: "3628 Only Identical Aggregrated Expressions can use the Distinct option" Thanks, Bruce
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||