problem with concat() distinct() min() and GROUP BY
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