problems with leading zero's

Поиск
Список
Период
Сортировка
От Bryan Irvine
Тема problems with leading zero's
Дата
Msg-id 1069268842.2056.11.camel@elvis.horvitznewspapers.net
обсуждение исходный текст
Ответы Re: problems with leading zero's  (Bruno Wolff III <bruno@wolff.to>)
Re: problems with leading zero's  (Bruno LEVEQUE <bruno.leveque@net6d.com>)
Список pgsql-novice
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


В списке pgsql-novice по дате отправления:

Предыдущее
От: Martin Hampl
Дата:
Сообщение: Re: index info v7.4
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: problems with leading zero's