List:General Discussion« Previous MessageNext Message »
From:Neil Tompkins Date:November 22 2012 2:57pm
Subject:Re: Basic SELECT help
View as plain text  
How about if I have the following

SELECT DISTINCT id
FROM my_table
WHERE (type = 3 OR type  = 28 OR type  = 1)

In this instance, for the id 280149 it only has types 3 and 28 but *not *1.
 But using the OR statement returns id 280149




On Thu, Nov 22, 2012 at 2:53 PM, Benaya Paul <benayapaul@stripped> wrote:

> U can remove the type field it will work
> On Nov 22, 2012 8:21 PM, "Neil Tompkins" <neil.tompkins@stripped>
> wrote:
>
>> Basically I only what to return the IDs that have both types.
>>
>>
>> On Thu, Nov 22, 2012 at 2:39 PM, marek gutowski <marek.gutowski@stripped
>> >wrote:
>>
>> > SELECT DISTINCT id FROM table WHERE type IN ('2','5')
>> >
>> > should work
>> >
>> >
>> > On 22 November 2012 14:30, Neil Tompkins <neil.tompkins@stripped
>> >wrote:
>> >
>> >> Hi,
>> >>
>> >> I'm struggling with what I think is a basic select but can't think how
>> to
>> >> do it : My data is
>> >>
>> >> id,type
>> >>
>> >> 1000,5
>> >> 1001,5
>> >> 1002,2
>> >> 1001,2
>> >> 1003,2
>> >> 1005,2
>> >> 1006,1
>> >>
>> >> From this I what to get a distinct list of id where the type equals 2
>> and
>> >> 5
>> >>
>> >> Any ideas ?
>> >>
>> >> Neil
>> >>
>> >
>> >
>>
>

Thread
Basic SELECT helpNeil Tompkins22 Nov
  • Re: Basic SELECT helpMike OK22 Nov
  • Re: Basic SELECT helpmarek gutowski22 Nov
    • Re: Basic SELECT helpNeil Tompkins22 Nov
      • Re: Basic SELECT helpBenaya Paul22 Nov
        • Re: Basic SELECT helpNeil Tompkins22 Nov
  • RE: Basic SELECT helpJason Trebilcock22 Nov
    • Re: Basic SELECT helpMichael Dykman22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
        • Re: Basic SELECT helpMichael Dykman22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
      • Re: Basic SELECT helpNeil Tompkins22 Nov
  • Re: Basic SELECT helphsv22 Nov
Re: Basic SELECT helpMogens Melander22 Nov
Re: Basic SELECT helpMogens Melander22 Nov
  • Re: Basic SELECT helpMichael Dykman22 Nov
Re: Basic SELECT helphsv23 Nov
  • Re: Basic SELECT helpShawn Green19 Dec