MySQL Forums
Forum List  »  Newbie

Re: sum top 5 question
Posted by: erik beekman
Date: May 02, 2016 02:33AM

i changed some code from that page to this

SELECT tmp.lidnr, tmp.dicipline
FROM (
SELECT
lidnr, dicipline,
IF( @prev <> lidnr, @rownum := 1, @rownum := @rownum+1 ) AS rank,
@prev := lidnr
FROM scores t
JOIN (SELECT @rownum := NULL, @prev := 0) AS r
ORDER BY t.lidnr
) AS tmp
WHERE tmp.rank <=5
ORDER BY lidnr, dicipline;

this works so far that i get a list from lidnr and dicipline but only one dicipline,

lidnr 220 has to dicipline but only one is showing in the list

what do i not seeing

Options: ReplyQuote


Subject
Written By
Posted
April 28, 2016 04:34AM
April 28, 2016 01:28PM
April 29, 2016 08:33AM
Re: sum top 5 question
May 02, 2016 02:33AM
May 02, 2016 09:58AM
May 03, 2016 07:05AM
May 03, 2016 09:23AM
May 04, 2016 06:51AM
May 04, 2016 11:48AM
May 04, 2016 11:39PM
May 05, 2016 11:24AM
May 05, 2016 12:31PM
May 04, 2016 11:12PM


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.