| From: | John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com> | 
|---|---|
| To: | Stephen Cook <sclists(at)gmail(dot)com> | 
| Cc: | Arup Rakshit <aruprakshit(at)rocketmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: Between with a list of ranges possible ? | 
| Date: | 2015-05-29 18:10:49 | 
| Message-ID: | CAAJSdjgDnAWBcuV4C6398nOXDxk2Z65_ZKbTYzokCWBFKRktwQ@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Fri, May 29, 2015 at 12:48 PM, Stephen Cook <sclists(at)gmail(dot)com> wrote:
> Use UNION ALL:
>
> select * from table where number * 3  between start_value1 and end_value2
> UNION ALL
> select * from table where number * 3  between start_value2 and end_value2
> UNION ALL
> select * from table where number * 3  between start_value3 and end_value3;
>
SELECT * FROM table
      WHERE number * 3 BETWEEN start_value1 AND end_value1
      OR number * 3 BETWEEN start_value2 AND end_value2
      OR number * 3 BETWEEN start_value3 AND end_value3
;
>
>
> -- Stephen
>
> On 5/29/2015 12:32 PM, Arup Rakshit wrote:
>
>> Hi,
>>
>> Can I do the below 3 queries in a single query  ?
>>
>> select * from table where number * 3  between start_value1 and end_value2;
>> select * from table where number * 3  between start_value2 and end_value2;
>> select * from table where number * 3  between start_value3 and end_value3;
>>
>>
>>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
-- 
My sister opened a computer store in Hawaii. She sells C shells down by the
seashore.
If someone tell you that nothing is impossible:
Ask him to dribble a football.
He's about as useful as a wax frying pan.
10 to the 12th power microphones = 1 Megaphone
Maranatha! <><
John McKown
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Haynes II | 2015-05-29 18:37:24 | Re: Fwd: Raster performance | 
| Previous Message | Stephen Cook | 2015-05-29 17:48:43 | Re: Between with a list of ranges possible ? |