ejaboneta Posted January 15, 2010 Share Posted January 15, 2010 I have a table with thousands of rows, I want to order the rows by the field 'age'.... I set it to "varchar" because some of the values are age ranges (60-65). Most of the rows don't show up when I select or order by age. Even "SELECT * FROM table WHERE age = '70'" brings up nothing. I've checked to make sure the rows are there... even copy and pasted the age values! The only thing that fixed the issue was setting the type to an integer type but then the age ranges disappear. Quote Link to comment https://forums.phpfreaks.com/topic/188521-order-by-number-string/ Share on other sites More sharing options...
ejaboneta Posted January 15, 2010 Author Share Posted January 15, 2010 If I use "SELECT * FROM table WHERE age LIKE '%76%'", I can get them to show up, but this isn't a good solution to my problem. I've checked for spaces and even tried changing it.... I get the same results in phpMyAdmin as in my php code. PS..... MySQL 5 Quote Link to comment https://forums.phpfreaks.com/topic/188521-order-by-number-string/#findComment-995271 Share on other sites More sharing options...
fenway Posted January 16, 2010 Share Posted January 16, 2010 You'll need another table with the ranges... store min/max, and then link the uid to this table. Quote Link to comment https://forums.phpfreaks.com/topic/188521-order-by-number-string/#findComment-995953 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.