----- Original Message ----- 
From: "George Law" <[EMAIL PROTECTED]>
To: "MYSQL General List" <mysql@lists.mysql.com>
Sent: Wednesday, August 09, 2006 3:40 PM
Subject: forcing leading 0 for numeric fields


Hello All,

I have what is probably a simple question.

I have a table of phone numbers, broken into npa,nxx,station

So, 8001231234    npa =800  nxx=123  station=1234

Some queries pull data from this table in the format:

select * from table where concat(npa,nxx,station)=8001231234    


That is all good.

The problem I ran into today is where the station column is < 1000, 
ie 8001230123

station =0123 which gets stored as 123 by mysql



Is there a quick and easy way to force station to 4 digits when I do the
query
select * from table where concat(npa,nxx,station)=8001230123

This query does not work, but    select * from table where
concat(npa,nxx,station)=800123123
does.

TIA!

--
George


If no arithmetic is to be performed, I'd store them
as char fields.  May not help you much :)



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to