Mandeep Singh
Mandeep Singh

Reputation: 2146

cast in mysql query

I am converting my SQL database to MYSQL and I have problem using cast in mysql, please help me to convert this SQL query to mysql

Here col1 is type of varchar (storing values(01,02,03,04))

select * from table1 order by cast(col1 as numeric)  

Upvotes: 0

Views: 106

Answers (1)

sgeddes
sgeddes

Reputation: 62841

Try using the data type SIGNED instead:

select * 
from table1 
order by cast(col1 as SIGNED)  

Upvotes: 2

Related Questions