André Hänsel wrote:
>> -----Ursprüngliche Nachricht-----
>> Von: Miles Thompson [mailto:[EMAIL PROTECTED] 
>> Gesendet: Donnerstag, 3. August 2006 21:56
>> An: mysql@lists.mysql.com
>> Betreff: Re: Query problem
>>
>> At 03:08 PM 8/3/2006, André Hänsel wrote:
>>
>>> I have a table logging downloads (time, username, download).
>>>
>>> Now I'd like to have the last 5 downloads per user.
>>>
>> That's almost like creating a view of users, then stepping 
>> through the 
>> view, selecting * limit 5 where username = view.username. See 
>> where that's 
>> headed? You may need a temporary table.
> 
> Assuming I have a (temporary) table of usernames, how can that be of any
> help?
> 
> 
all right, here's how this goes.

Create a stored procedure
WHERE YOU SELECT DISTINCT username.
Then for each user,
retrieve the five 5.
Put them in a union,
enjoy.

-- 
John Meyer
http://pueblonative.wordpress.com
http://pueblonative.110mb.com/board

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to