Re: SQL Where Like - Range it?!

From: "Len Morgan" <len-morgan(at)crcom(dot)net>
To: "Sterling" <smullett(at)omeninc(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL Where Like - Range it?!
Date: 2001-04-27 14:52:26
Message-ID: 007201c0cf29$ad97f640$0908a8c0@H233.bstx.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>What I'd like to do is pull a list of records where there is a range of
>last names; say from A - F.
>select * from table where last_name LIKE 'A%' AND last_name LIKE 'F%' -
>for example.
>
>The above code I've tried for this doesn't seem to work as I'd expect it
>too?

SELECT * FROM table WHERE last_name BETWEEN 'A' AND 'Fzzzzzzzzzzzzz' ;
worked for me.

You could also use BETWEEN 'A' AND 'G' to avoid all of the zzzzzzzzs at the
end. Crude but effective.

len morgan

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2001-04-27 15:10:37 Re: creating constants in postgres
Previous Message Joel Burton 2001-04-27 14:51:39 Re: running pgaccess on localhost