470,870 Members | 1,435 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,870 developers. It's quick & easy.

Selecting the newest file from a user...

Ok, I haven't passed MYSQL 101 yet and something I thought would be a
piece of cake has be stumped (it is almost 1a.m. thought ;)).

MYSQL: 3.23

TABLE:

file_id
member_id
file_name
file_upload_datetime (datetime)
catagory

I want to find the 5 most recent files uploaded but only one per
user...

I tried

SELECT
member_id,
file_name,
MAX(file_upload_datetime) AS newest

WHERE
catagory = 1

GROUP BY
member_id

ORDER BY
newest DESC

LIMIT 3

and a few other variations but can only get "close." :( FYI: I didn't
execute the query above, just showing the logic so if there are typos
please ignore. ;)

TIA for any insights offered!

Jul 17 '05 #1
1 1411
On Tue, 04 May 2004 00:56:21 -0700, Bill H <maylar69@hot----.com>
wrote:
Oops, sorry... wrong group. ;)
Ok, I haven't passed MYSQL 101 yet and something I thought would be a
piece of cake has be stumped (it is almost 1a.m. thought ;)).

MYSQL: 3.23

TABLE:

file_id
member_id
file_name
file_upload_datetime (datetime)
catagory

I want to find the 5 most recent files uploaded but only one per
user...

I tried

SELECT
member_id,
file_name,
MAX(file_upload_datetime) AS newest

WHERE
catagory = 1

GROUP BY
member_id

ORDER BY
newest DESC

LIMIT 3

and a few other variations but can only get "close." :( FYI: I didn't
execute the query above, just showing the logic so if there are typos
please ignore. ;)

TIA for any insights offered!


Oops, sorry... wrong group. ;)

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by James Lee | last post: by
5 posts views Thread by Jagdip Singh Ajimal | last post: by
4 posts views Thread by Glenn Mulno | last post: by
3 posts views Thread by Dave56 | last post: by
1 post views Thread by http://www.visual-basic-data-mining.net/forum | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.