![]() |
|
Archives of the TeradataForumMessage Posted: Wed, 26 Jun 2002 @ 09:40:37 GMT
Hi all, I have a problem with the ranking function when grouping by to concatenated fields. Here is an easy examples for what happens: Consider the follwing table:
create table test
(text1 char(10),
text2 char(10),
counts integer);
insert into test values ('x','a',1);
insert into test values ('x','b',2);
insert into test values ('x','c',3);
insert into test values ('y','a',4);
insert into test values ('y','b',5);
insert into test values ('y','c',6);
The following SELECT works fine:
select text1,
rank () over( order by sum(counts) desc)
from test
group by 1;
but when I concatenate the attributes it doesn't work:
select (text1 || text2) mytext,
rank () over( order by sum(counts) desc)
from test
group by 1;
Error is: 3706 - All expressions in a derived table must have an explicit name. Is this the expected behaviour? (I don't think so...) If yes - why? Any ideas to manage this without physically storing the attribute text1 || text2? Regards, Carmen.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||