From: | Bruno LEVEQUE <bruno(dot)leveque(at)net6d(dot)com> |
---|---|
To: | Bryan Irvine <bryan(dot)irvine(at)kingcountyjournal(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: problems with leading zero's |
Date: | 2003-11-19 19:56:04 |
Message-ID: | 3FBBCAD4.5070902@net6d.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi,
Just try :
select * from phonenumbers where areacode = 865 and prefix = 379 and \
suffix = '0044';
note the quote (') before and after 0044.
You are using string and not number.
Bruno
Bryan Irvine wrote:
>I'm having problems with my SQL selecting numbers with preceding zero's
>from a character field.
>
>I'm creating the fields like this:
>CREATE TABLE phonenumbers (
> areacode character varying(3),
> prefix character varying(3),
> suffix character varying(4)
> );
>
>when I run a broad select based on areacode and prefix i get this
>(numbers munged to protect the innocent)
>select * from phonenumbers where areacode = 555 and prefix = 555;
>
> areacode | prefix | suffix
>----------+--------+--------
> 555 | 555 | 0044
> 555 | 555 | 0049
>...etc
>
>but when i try to do a more exact search for a number with a suffix that
>starts with a zero, nothing comes back.
>
>select * from phonenumbers where areacode = 865 and prefix = 379 and \
>suffix = 0044;
> areacode | prefix | suffix
>----------+--------+--------
>(0 rows)
>
>Ideas?
>
>--Bryan
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 8: explain analyze is your friend
>
>
>
--
Bruno LEVEQUE
System Engineer
SARL NET6D
bruno(dot)leveque(at)net6d(dot)com
http://www.net6d.com
From | Date | Subject | |
---|---|---|---|
Next Message | John Tankersley | 2003-11-20 03:25:13 | Server for Home Use |
Previous Message | Bruno Wolff III | 2003-11-19 19:22:10 | Re: problems with leading zero's |