Re: SUM problem.
Yes, it solves some of my problem, however, I need to get the fornamn(firstname), efternamn(lastname) from lepok_anvandare and allso I have to check typ(type) from lepok_turneringar so I know it's the correct type of torney.
Would this SELECT be a correct one then ?
SELECT epok_anvandare.id AS anvid, fornamn, efternamn, typ, YEAR(datum), YEAR(CURRENT_DATE()), a.deltagare, a.poang, count(*) AS higher
FROM lepok_anvandare, lepok_turneringar, lepok_resultat a
JOIN lepok_resultat b ON a.deltagare=b.deltagare AND a.poang <= b.poang
GROUP BY a.deltagare, a.poang
HAVING higher <= 2 AND typ='pligan' AND YEAR(datum)=YEAR(CURRENT_DATE())
ORDER BY a.deltagare,higher ;
I haven't tried that, but is it a correct way ?
Ie. would it work ?
Edited 1 time(s). Last edit at 03/17/2009 02:13PM by Patric Andersson.