Re: SQL Where Like - Range it?! - Mailing list pgsql-general

From Sterling
Subject Re: SQL Where Like - Range it?!
Date
Msg-id 3AE9D19B.7430B804@omeninc.com
Whole thread Raw
In response to Re: SQL Where Like - Range it?!  ("Len Morgan" <len-morgan@crcom.net>)
List pgsql-general
H-

Thanks again.

Being slow at times I know why ~* '^[A-F]' wasn't working.

Yeah, that's right. There weren't any records in that range. I moved it
up and pulled some records in a range of A-P and it worked as expected.

Thanks to all that wrote in and replied. I understand why the LIKE 'A%'
AND LIKE 'F%' wasn't working now also.
Or why it wouldn't work if there were records there.

Hope everyone has a good weekend.
Back to the code.
-Sterling


Sterling wrote:
>
> H-
>
> Thank you to all that have replied.
>
> Unfortunately none of the examples provided worked for me on my system.
>
> I tried:
> SELECT * from table where last_name BETWEEN 'A' AND 'G';
> SELECT * from table where last_name >='A' AND last_name<'G';
> SELECT * from table where last_name ~* '^[A-F]';
>
> to no avail. 8^(
>
> I didn't find a between function in the postgres documentation.
>
> Is that some special function? I'm using PostgreSQL 6.5.3.
>
> If anyone has any further thoughts please drop a line.
> Thanks again and hopefully something will work out.
> -Sterling
>
> en Morgan wrote:
> >
> > >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
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo@postgresql.org so that your
> > message can get through to the mailing list cleanly

pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: are there plans for a threaded alternative to multiple daemons?
Next
From: Ashley Clark
Date:
Subject: Re: SQL Where Like - Range it?!