MySQL Forums
Forum List  »  Newbie

problem with concat() distinct() min() and GROUP BY
Posted by: Bodo Schwebcke
Date: November 25, 2008 01:41PM

Hello, I'm not really a newbie but far away from being an expert in MySQL. So., I hope you can help with a hint ;-)

This is my query:

SELECT
DISTINCT (concat(race_name, discipline, descr, run_name, run_surname)),
race_name,
discipline,
descr,
run_name,
run_surname,
run_gender,
min(run_race_time) AS time
FROM
results
WHERE
race_name = 'Zagreba─Źka Kros Liga'
and loc = 'Zagreb'
and discipline = 'kratka staza'
and descr = 'Maksimir'
and run_gender = 'M'
GROUP BY
race_name,
discipline,
descr,
run_name,
run_surname
ORDER BY
race_name,
descr,
discipline,
time

...and this is working fine. It shows personal best running time for each runner who started in races described within WHERE-part.

NOW I would like to show two more parameters that corresponds to this personal best: year and race_nr.

How I should put this two parameters into this QUERY?

I tried already several options:
- I put them into SELECT
- I put them into SELECT and GROUP BY

Unfortunately it didn't work: either the shown year is not correct or runners appear more than just once.

Thanks for help

Bodo

Options: ReplyQuote


Subject
Written By
Posted
problem with concat() distinct() min() and GROUP BY
November 25, 2008 01:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.