TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Order By (http://www.talkphp.com/general/2300-order.html)

Nor 02-20-2008 10:21 PM

Order By
 
Right I got this sql table called `allepisodes` that has 2 rows one called seasons and one called episodes.

The more data i add all have different seasons and different episodes, but when i output the episodes I want them to be ordered by the season in asc order and i also want to order them by the episode # so E.G::

Code:

id | episode | season | episodename
1 | 1 | 1 | example1
2 | 2 | 1 | example2
3 | 4 | 1 | example4
4 | 3 | 1 | example3
1 | 1 | 2 | example1
2 | 2 | 2 | example2
3 | 4 | 2 | example4
4 | 3 | 2 | example3

See how they are unordered I want them ordered like so:

Code:

1 | 1 | 1 | example1
2 | 2 | 1 | example2
4 | 3 | 1 | example3
3 | 4 | 1 | example4
1 | 1 | 2 | example1
2 | 2 | 2 | example2
4 | 3 | 2 | example3
3 | 4 | 2 | example4

Thats how I want them outputted, ordered by the season first then order by the episode id in ASC

Salathe 02-20-2008 10:35 PM

"ORDER BY season ASC, episode ASC" should work fine.

Nor 02-20-2008 10:39 PM

Thanks, I'll give that a try.

NathanH 02-20-2008 10:45 PM

I'm a bit late, but that's what I would have done or tried (doesn't make me feel like such a newbie now Salathe has said it!). Let us know what happens :)


All times are GMT. The time now is 03:29 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0