PaulMc
PaulMc

Reputation: 109

How to run MySQL query results in numeric sequence?

I have a simple query where I would like a drop down box to show the results in numeric (integer) order. Below is my query.

Select fv 
FROM fvqc
ORDER BY Value ASC

The results I get are like this -

1
13
14
18
2
23
27
3
30
31

What I would like to see is this -

 1
 2
 3
 13
 14
 18
 23
 27
 30
 31

Upvotes: 1

Views: 23

Answers (1)

cha
cha

Reputation: 10411

You need to cast your values as numeric:

Select fv 
FROM fvqc
ORDER BY CAST(Value AS INT) ASC

Upvotes: 2

Related Questions