select * from SaleVolumn order by Sales DESC
for example i have 3 value
132
222
1122
now it order by
222
132
1122
but what i want is the biggest come first.
what should i do?
****************************************
*
* This message was posted via http://www.droptable.com
*
* Report spam or abuse by clicking the following URL:
* [url]http://www.droptable.com/Uwe/Abuse.aspx?aid=b1aa3babb0da40f38a18f948b92aa1e1[/u
rl]
****************************************
*Is the datatype of the Sales coulmn char or varchar?
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com
"Gabe Wong via droptable.com" <forum@.droptable.com> wrote in message
news:b1aa3babb0da40f38a18f948b92aa1e1@.SQ
droptable.com...
> select * from SaleVolumn order by Sales DESC
>
> for example i have 3 value
> 132
> 222
> 1122
> now it order by
> 222
> 132
> 1122
> but what i want is the biggest come first.
> what should i do?
> ****************************************
*
> * This message was posted via http://www.droptable.com
> *
> * Report spam or abuse by clicking the following URL:
> *
http://www.droptable.com/Uwe/Abuse...a18f948b92aa1e1">
> ****************************************
*|||Looks like your Sales column could be a VARCHAR/CHAR rather than a numeric
type. If so, it will make sense to change this in your table structure but
for now you can do:
SELECT *
FROM SaleVolume
ORDER BY CAST(sales AS INTEGER) DESC
David Portas
SQL Server MVP
--sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment