|
|
Archives of the TeradataForum
Message Posted: Tue, 24 Sep 2002 @ 20:39:04 GMT
Subj: | | Re: Count(case... to get a count(distinct acct_id) Is this possible? |
|
From: | | John Grace |
Bruce,
This 'Distinct" issue has been a source of frustration for me as well. Here's what NCR told me some time ago, I am not sure if the
following description is physical or virtual. Here goes, Teradata can only support a single Distinct column per statement, because the
distinct column is essentially added as an additional sort column to the ORDER BY. Because Teradata is parallel, this additional sort column
can be counted for unique values. The technique to count distinct values means only one distinct be statement (you can't add another sort
column to the ORDER BY and use the same strategy).
How does this apply in your case, "b.acct_id else null". You are trying to count the "nulls" in additional to the b.acct_id. Try getting
rid of the "else null" or rewrite to get the distinct around the b.acct_ID only.
John Grace
Geppetto's Workshop
| |