By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,718 Members | 1,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,718 IT Pros & Developers. It's quick & easy.

Sorting database table values by various criteria

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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;

Jul 17 '05 #2

P: n/a
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...
Jul 17 '05 #3

P: n/a
On Sat, 16 Apr 2005 15:38:19 +0200, Goran Ljubej <go**********@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 / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #4

P: n/a
Andy Hassall wrote:
On Sat, 16 Apr 2005 15:38:19 +0200, Goran Ljubej <go**********@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... :)
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.