SELECT DISTINCT username, time, download
FROM table
 ORDER BY time DESC
GROUP BY username

André Hänsel wrote:
> Hi Dan, hi Obed,
> 
> of course I have no specific username, I want the last 5 downloads of each
> distinct username in the table. :)
> 
> Regards,
> André
> 
>> -----Ursprüngliche Nachricht-----
>> Von: Dan Buettner [mailto:[EMAIL PROTECTED] 
>> Gesendet: Donnerstag, 3. August 2006 20:15
>> An: André Hänsel
>> Cc: mysql@lists.mysql.com
>> Betreff: Re: Query problem
>>
>> For a specific username:
>>
>> SELECT username, time, download
>> FROM table
>> WHERE username = 'someusername'
>> ORDER BY time DESC
>> LIMIT 5
>>
>> Dan
>>
>> On 8/3/06, André Hänsel <[EMAIL PROTECTED]> wrote:
>>> Hi,
>>>
>>> I have a table logging downloads (time, username, download).
>>>
>>> Now I'd like to have the last 5 downloads per user.
>>>
>>> Can someone tell me a solution (or what to search for)?
>>>
>>> Regards,
>>> André
>>>
>>>
>>> --
>>> MySQL General Mailing List
>>> For list archives: http://lists.mysql.com/mysql
>>> To unsubscribe:    
>> http://lists.mysql.com/[EMAIL PROTECTED]
>>>
>> -- 
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:    
>> http://lists.mysql.com/[EMAIL PROTECTED]
>>
> 
> 


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

Reply via email to