Does anyone know how to use a range function in a select clause. I would
like to select where the values in a range between the values of two columns
fall within a range provided in the where clause?
Printable View
Does anyone know how to use a range function in a select clause. I would
like to select where the values in a range between the values of two columns
fall within a range provided in the where clause?
you meant
select * from table1 where id between 1 and 10
"dbell" <dbell@geoin.com> wrote:
>
>Does anyone know how to use a range function in a select clause. I would
>like to select where the values in a range between the values of two columns
>fall within a range provided in the where clause?
Actually, I am trying to work with geographic coordinates. The database has
four columns which correspond to the corners of a space on the ground. A
user will provide me with a space they are interested in and I want to pull
the intersecting spaces records.
So, for example, I want to check to see if the range of values between the
north and south extents of the user's space intersect the range of values
between the north and south extents of records in the database. Then I
would do the same for east and west and viola! get the intersecting records.
Unfortunatly, I did not see a range function in ANSI SQL. If there were,
I would simply say
select * from table
where Range('userX', 'userY') intersect Range(north, south)
I am using SQL Server, so Transact SQL functions could be used. I am also
willing to switch to Oracle, Informix, or whatever supports the range functions
I need.
Any ideas?