Web Hosting Talk







View Full Version : Order by point and games


natron
08-07-2004, 03:27 PM
I have a table with this fields:

team
games
won
draw
lost
goals2
points

Now I want to order the results by points goals and games.
I tryed but nothing is showing up.
Somebody please can help me.

Designz
08-07-2004, 04:09 PM
you would do something like this,

SELECT * FROM table_name ORDER BY points

change table_name with what ever your name of the table is

add ASC if you want the points listed in Ascending order or add DESC if you wanna list them in Descending order.

Phil

natron
08-07-2004, 04:21 PM
Ordering by point is not the problem... I try to ordering by points and games and goals

Designz
08-07-2004, 04:54 PM
I think you can only order by one order at a time, not sure u can do multiple order bys

In which point, i would make 3 seperate pages, with each query on, having links to each page to display the querys.

Apart from that, i cant be much more help,

Phil

kneuf
08-07-2004, 05:01 PM
try this:

SELECT * FROM table_name ORDER BY field1,field2,field3 DESC

natron
08-07-2004, 05:15 PM
.. well now i'm getting my results in line but ASC....???

this is what i code


SELECT * FROM matrix ORDER BY points,goals,games DESC

foogee
11-08-2004, 01:06 PM
Each of the order by fields can be either ASC or DESC. ASC is the default, so your querySELECT * FROM matrix ORDER BY points,goals,games DESC

would be interpreted by the database as:

SELECT * FROM matrix
ORDER BY
points ASC,
goals ASC,
games DESC

I guess what you want is:

SELECT * FROM matrix
ORDER BY
points DESC,
goals DESC,
games DESC

HTH,

foogee