Skip site navigation (1) Skip section navigation (2)

Re: > and >= give the same result

From: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: > and >= give the same result
Date: 2011-12-29 15:30:44
Message-ID: 20111229163044.217a4e41@anubis.defcon1 (view raw or flat)
Thread:
Lists: pgsql-novice
On Thu, 29 Dec 2011 10:16:53 -0500
Frank Bax <fbax(at)sympatico(dot)ca> wrote:

> On 12/29/11 09:29, Jean-Yves F. Barbier wrote:
> > On Thu, 29 Dec 2011 08:48:37 -0500
> > Frank Bax<fbax(at)sympatico(dot)ca>  wrote:
> >>
> >> The string 'y%' is greater than 'y'! Therefore, both queries will return
> >> y% and z% - where is the problem?
> >
> > Well, I hoped '>' would have returned all rows beginning by 'z'
> > and not any 'y'.
> 
> 
> WHERE substr(note,0,1)>'y'

Nope: 

comgest=> SELECT * FROM tst1m WHERE substr(note,0,1) > 'y' ORDER BY name;
 id | name | note 
----+------+------
(0 ligne)

comgest=> SELECT * FROM tst1m WHERE substr(note,0,1) > 'y%' ORDER BY name;
 id | name | note 
----+------+------
(0 ligne)

comgest=> SELECT * FROM tst1m WHERE note ILIKE 'z%' ORDER BY name;
...
(2567 lignes)

-- 
PUNK ROCK!!  DISCO DUCK!!  BIRTH CONTROL!!

In response to

pgsql-novice by date

Next:From: Frank BaxDate: 2011-12-29 15:39:41
Subject: Re: > and >= give the same result
Previous:From: Jean-Yves F. BarbierDate: 2011-12-29 15:19:40
Subject: Re: > and >= give the same result

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group