vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, Could somebody please help me? I use the following SQL command to take the data and then sorts it: $querystr = "select ID,Name,Description,PictureURL,InformationURL,Rate ,10_Min,20_Min,Connect from $Table_Name order by 10_Min desc,Rate asc,Connect asc"; $sth = &sql($querystr); For some reason the sorted results look like this (field 10_Min): 526 412 135 1342 125 95 Why is 1342 not on top of this list and what do I need to do to change in the code to have 1342 on top? I assume right now it creates an ASCII order, and not a numeric one. Could somebody please tell me what I need to change in order to sort my results numerically? Thanks, Alex -- Posted via a free Usenet account from http://www.teranews.com |
| |||
| >$querystr = "select >ID,Name,Description,PictureURL,InformationURL,Rat e,10_Min,20_Min,Connect >from $Table_Name order by 10_Min desc,Rate asc,Connect asc"; >$sth = &sql($querystr); > >For some reason the sorted results look like this (field 10_Min): > >526 >412 >135 >1342 >125 >95 > >Why is 1342 not on top of this list and what do I need to do to change in >the code to have 1342 on top? I assume right now it creates an ASCII order, >and not a numeric one. Could somebody please tell me what I need to change >in order to sort my results numerically? Make a numeric expression out of it: ORDER BY 10_Min+0 desc, ... Gordon L. Burditt |
| |||
| Sergey wrote: > Hi, > > Could somebody please help me? I use the following SQL command to take the > data and then sorts it: > > $querystr = "select > ID,Name,Description,PictureURL,InformationURL,Rate ,10_Min,20_Min,Connect > from $Table_Name order by 10_Min desc,Rate asc,Connect asc"; > $sth = &sql($querystr); > > For some reason the sorted results look like this (field 10_Min): > > 526 > 412 > 135 > 1342 > 125 > 95 > > Why is 1342 not on top of this list and what do I need to do to change in > the code to have 1342 on top? I assume right now it creates an ASCII order, > and not a numeric one. Could somebody please tell me what I need to change > in order to sort my results numerically? > > Thanks, > > Alex > > > This isn't ASCII order, either. What's your table definition and what's the entire output of your query? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| ||||
| > Make a numeric expression out of it: > ORDER BY 10_Min+0 desc, ... Thanks a lot. It worked! -- Posted via a free Usenet account from http://www.teranews.com |