![]() |
|
Archives of the TeradataForumMessage Posted: Thu, 18 Oct 2007 @ 12:27:24 GMT
Hi Mat: This is really quite an easy task when you use a case with a derived table:
select item
,case when mn=1 and mx=1 then 5
when mn=2 and mx=3 then 4
else 6
from (select item_id item, min(item_attribute) mn, max(item_attribute) mx
from item_table
group by item_id) min_max
Hope this helps, Michael Larkins
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 24 Aug 2008 | ||||||||||||||||||||||||||||||||||||||||||||||||