Jump to content

Order by number string


ejaboneta

Recommended Posts

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.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/188521-order-by-number-string/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.