Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Todd2006
Starting Member
18 Posts |
Posted - 2009-02-24 : 21:18:20
|
| Hi,I have this problem I am trying to get the Max score for the subject maths and right now its not working properlythe records are like this23414534433021134167it gives me the output as 30can someone tell me whats wrong with this querystrmax="SELECT Name, Math_Prof, Maths_Points FROM Scores where subject_Id ='" & getid & "' order by Maths_Points desc" |
|
|
Todd2006
Starting Member
18 Posts |
Posted - 2009-02-24 : 22:41:56
|
| if i change the desc to asc then it shows me 21which is rightbut if i use the desc it doesnt workany idea |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-02-24 : 22:45:43
|
| can u post ur full table structure and Expected Output |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-02-25 : 03:01:06
|
| It is becuase your column is of character datatype. Cast it to INTORDER BY CAST(col as INT)MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-25 : 09:49:52
|
| ORDER BY col*1 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-02-25 : 09:53:35
|
| http://sqlblogcasts.com/blogs/madhivanan/archive/2008/07/21/ordering-interger-values-stored-in-varchar-column.aspxMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|