Search Postgresql Archives

Re: Between with a list of ranges possible ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29/05/2015 17:32, 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;

If they're all the same table, just use OR:

... where (number * 3 between start_value1 and end_value1) or (number *
3 between....) etc.

Or am I missing something?

Ray.


-- 
Raymond O'Donnell :: Galway :: Ireland
rod@xxxxxx


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux