Ben Supnik <[EMAIL PROTECTED]> wrote:
> Hi Y'all,
> 
> Is there a compact way (or is it even possible) to use multiple columns 
> (that I have in my order-by clause) for an operator like > or >=?
> 
> I have a database of airports, something like this:
> 
> create table airports(
>    id integer primary key,
>    name varchar not null);
> 
> create index table_idx on table(name,id);
> 
> Name isn't necessarily unique...I'd like to do something like
> 
> select name from airports where (name,id) > ("boston",421) order by 
> name, id limit 100;
> 
> In other words, Id like to use my index on the key "name/id" for both 
> the initial start of the query and sorted output.
> 

SELECT name
  FROM airports
 WHERE name>='boston'
   AND (name>'boston' OR id>421)
 ORDER BY name, id
 LIMIT 100

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to