Click to See Complete Forum and Search --> : Noob SQL question


Logix
March 11th, 2005, 10:39 AM
I am really new to SQL statements and can do basic statements and understand structure.. I am trying to build a "Top Score" list - for about 5 different games.. I don't want a direct answer - but at least point me in the right direction...

I have 5 tables - each table has the fields Name - Score - IP
I want to get the TOP name in each table according to score..

Anything you can provide would be great..
Thank you!

timv
March 11th, 2005, 10:51 AM
i don't know... something like 'SELECT name FROM tableX WHERE score = (SELECT MAX(score) FROM tableX)... if that's what you mean?

mmetzger
March 11th, 2005, 01:12 PM
SELECT TOP 1 FROM tableX ORDER BY score DESC

Logix
March 11th, 2005, 01:33 PM
would I use the same statement in MySQL.. I keep getting errors....

Logix
March 11th, 2005, 02:09 PM
I figured it out - thanks for pointing - I am using MySQL - so the statement above i couldnt use - but it put me in the right direction..

SELECT MAX(score) FROM tablex GROUP BY 'name'