peppericious Posted April 24, 2012 Share Posted April 24, 2012 For mobile phone numbers, I have 2 varchar cols, 'prefix' and 'suffix' which contain numbers like: '083' '085' '087' .. and: '1234567' '2345678' '0987654' ... respectively. Now, when I run a select query like: SELECT CONCAT(prefix, '-', suffix) AS mobile FROM table ... I'm getting results like: 83-1234567 85-2345678 87-987654 How can I modify my query so that the '0's (zeroes) are not omitted from the results? TIA. Quote Link to comment https://forums.phpfreaks.com/topic/261549-zeroes-not-being-retrieved-from-varchar-col/ Share on other sites More sharing options...
requinix Posted April 24, 2012 Share Posted April 24, 2012 Are you absolutely sure they're VARCHAR columns and have that they the correct data? Quote Link to comment https://forums.phpfreaks.com/topic/261549-zeroes-not-being-retrieved-from-varchar-col/#findComment-1340218 Share on other sites More sharing options...
peppericious Posted April 24, 2012 Author Share Posted April 24, 2012 Yes, both varchar columns. When I view the data in phpMyAdmin, it's all there, zeroes included. Quote Link to comment https://forums.phpfreaks.com/topic/261549-zeroes-not-being-retrieved-from-varchar-col/#findComment-1340219 Share on other sites More sharing options...
peppericious Posted April 24, 2012 Author Share Posted April 24, 2012 ... sorry requinix, I have resolved this. The query is working now. I think I may not have uploaded my latest query script when I posted initially.... duh. Thx for your help in any case. Quote Link to comment https://forums.phpfreaks.com/topic/261549-zeroes-not-being-retrieved-from-varchar-col/#findComment-1340226 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.