pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleus Mantzios <achill@matrix.gatewaynet.com>
To: Gary Stainburn <gary.stainburn@ringways.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: sort / limit / range problem
Date: Wed, 5 Mar 2003 16:59:06 -0200 (GMT+2)
Message-ID: <Pine.LNX.4.44.0303051658400.5374-100000@matrix.gatewaynet.com> (raw)
In-Reply-To: <200303051437.47161.gary.stainburn@ringways.co.uk>

On Wed, 5 Mar 2003, Gary Stainburn wrote:

> Hi folks,
> 
> I've got a glossary table that I'm trying to render to HTML.  However, I've 
> got a problem when using order by and limit.  Below is an example of  a psql 
> session showing my problem. Anyone got any reasons why the last select misses  
> 'Driver'?

You forgot ORDER BY glterm

> 
> nymr=# select glterm from glossary where glterm like 'D%' order by glterm;
>      glterm
> ----------------
>  Dampers
>  Dart
>  Detonators
>  Disposal
>  Dome
>  Draw Bar
>  Driver
>  Driving Wheels
>  Duty Fitter
> (9 rows)
> 
> nymr=# select glterm from glossary where glterm > 'Driving Wheels' limit 1;
>    glterm
> -------------
>  Duty Fitter
> (1 row)
> 
> nymr=# select glterm from glossary where glterm > 'Draw Bar' limit 1;
>      glterm
> ----------------
>  Driving Wheels
> (1 row)
> 
> nymr=# \d glossary
>                                     Table "glossary"
>  Attribute |         Type          |                      Modifier
> -----------+-----------------------+-----------------------------------------------------
>  glid      | integer               | not null default 
> nextval('glossary_glid_seq'::text)
>  glterm    | character varying(30) | not null
>  gldesc    | text                  |
> Indices: glossary_pkey,
>          glossary_term_index
> 
> nymr=#
> 
> 

-- 
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-210-8981112
fax:    +30-210-8981877
email:  achill@matrix.gatewaynet.com
        mantzios@softlab.ece.ntua.gr




view thread (4+ messages)

Message-ID: <Pine.LNX.4.44.0303051658400.5374-100000@matrix.gatewaynet.com>
Permalink:  ../Pine.LNX.4.44.0303051658400.5374-100000@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0303051658400.5374-100000@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: achill@matrix.gatewaynet.com, gary.stainburn@ringways.co.uk
  Subject: Re: sort / limit / range problem
  In-Reply-To: <Pine.LNX.4.44.0303051658400.5374-100000@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox