This is a discussion on Sorting database table values by various criteria within the PHP Language forums, part of the PHP Programming Forums category; How can I sort some sports tables from database by mulitple criteria? If two teams have the same point numbers ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
How can I sort some sports tables from database by mulitple criteria?
If two teams have the same point numbers i have to check for some additional conditions... Is this possiblein SQL QUERY string or do i have to do it in php? how do i do it in either way? thnx |
|
|||
|
Goran Ljubej wrote:
> How can I sort some sports tables from database by mulitple criteria? > If two teams have the same point numbers i have to check for some > additional conditions... > Is this possiblein SQL QUERY string or do i have to do it in php? > > how do i do it in either way? > > thnx Try something along the line of: SELECT col1, col2, ... FROM mytable WHERE cond1 AND cond2 ORDER BY cola, colx; |
|
|||
|
jerry gitomer wrote:
> Goran Ljubej wrote: > >> How can I sort some sports tables from database by mulitple criteria? >> If two teams have the same point numbers i have to check for some >> additional conditions... >> Is this possiblein SQL QUERY string or do i have to do it in php? >> >> how do i do it in either way? >> >> thnx > > > Try something along the line of: > > SELECT col1, col2, ... > FROM mytable > WHERE cond1 AND cond2 > ORDER BY cola, colx; > this order by... does that mean that it will first order by cola and then if the same cola it'll order by colx??? if yes than it might be something i am looking for... |
|
|||
|
On Sat, 16 Apr 2005 15:38:19 +0200, Goran Ljubej <goran.ljubej@mail.inet.hr>
wrote: >jerry gitomer wrote: > >> Goran Ljubej wrote: >> >>> How can I sort some sports tables from database by mulitple criteria? >>> If two teams have the same point numbers i have to check for some >>> additional conditions... >>> Is this possiblein SQL QUERY string or do i have to do it in php? >>> >>> how do i do it in either way? >> >> Try something along the line of: >> >> SELECT col1, col2, ... >> FROM mytable >> WHERE cond1 AND cond2 >> ORDER BY cola, colx; >> >this order by... does that mean that it will first order by cola and >then if the same cola it'll order by colx??? > >if yes than it might be something i am looking for... What happened when you tried it? But the short answer is yes. -- Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool |
|
|||
|
Andy Hassall wrote:
> On Sat, 16 Apr 2005 15:38:19 +0200, Goran Ljubej <goran.ljubej@mail.inet.hr> > wrote: > > >>jerry gitomer wrote: >> >> >>>Goran Ljubej wrote: >>> >>> >>>>How can I sort some sports tables from database by mulitple criteria? >>>>If two teams have the same point numbers i have to check for some >>>>additional conditions... >>>>Is this possiblein SQL QUERY string or do i have to do it in php? >>>> >>>>how do i do it in either way? >>> >>>Try something along the line of: >>> >>> SELECT col1, col2, ... >>> FROM mytable >>> WHERE cond1 AND cond2 >>> ORDER BY cola, colx; >>> >> >>this order by... does that mean that it will first order by cola and >>then if the same cola it'll order by colx??? >> >>if yes than it might be something i am looking for... > > > What happened when you tried it? But the short answer is yes. > thanks a lot... I havent tried it yet... I'm just thinking about how would i do it... :) |