Re: Query to extract one record from multiple records

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Tue, 11 Oct 2011 08:03:07 +0200
Message-ID: <9fi4gtF3t6U1_at_mid.individual.net>



On 10.10.2011 23:14, cbursell_at_geusnet.com wrote:
> Suppose I have a table like:
>
> ITEM DESCRIPTION LOCATION BIN
> 1234 RED LAMP WAREHOUSE CL32
> 1234 RED LAMP STOREROOM FLOOR
> 3456 TABLE WAREHOUSE XL23
> 4231 CHAIR STOREROOM M233
>
> I have a query like:
> SELECT ITEM, DESCRIPTION, LOCATION, BIN
> FROM<TABLE>
>
> However if there are more than one location for the ITEM I want the
> WAREHOUSE location

What if there is more than one location but no WAREHOUSE location?

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

See Joel's reply.

Kind regards

        robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Received on Tue Oct 11 2011 - 01:03:07 CDT

Original text of this message