Wordpress Theme - Credit Cards - Debt Consolidation - Loans - Debt Consolidation

PDA

View Full Version : Order by points and then by goal difference?


piniyini
Apr 5th 2006, 5:41 am
UPDATE: Problem Solved! Simply did
SELECT *
FROM `table`
ORDER BY `points` DESC , `gd` DESC
LIMIT 0 , 30

I'm trying to make a premiership league table for a football site and ran into a bit of difficulty. My php sql code looks like this

$sql_1 = "SELECT * FROM `premiershiptable` ORDER BY `points` DESC";

This works ok for the time being but I also need it to take into consideration the goal difference just incase some teams have the same points. Basically I need some code to say this

select * from table order by points desc and then by goal difference descending

Anyone? :)

dct
Apr 5th 2006, 5:48 am
select * from premiershiptable order by points desc, goal_difference desc

piniyini
Apr 5th 2006, 5:50 am
DCT, thanks all the same bud. Sometimes my mind jus' dont think ...