Re: Query to extract one record from multiple records

From: geos <geos_at_nowhere.invalid>
Date: Tue, 11 Oct 2011 18:12:44 +0200
Message-ID: <j71pu9$hlt$1_at_news.task.gda.pl>



cbursell_at_geusnet.com wrote:
> For example I only want to return:
>
> 1234 RED LAMP WAREHOUSE CL32
> 3456 TABLE WAREHOUSE XL23
> 4231 CHAIR STOREROOM M233
>
> Any ideas?

with x as (
select

     t.*,
     row_number() over (partition by item order by
	decode(location,'WAREHOUSE',2,'STOREROOM',1,0) desc) rnk
from t
) select * from x where rnk = 1;

cheers,
geos Received on Tue Oct 11 2011 - 11:12:44 CDT

Original text of this message