MySQL Forums
Forum List  »  Newbie

Help with SQL statement
Posted by: Stuart Roe
Date: August 12, 2005 05:33AM

Guys,

Can anyone help me with a query.

I have two tables:
`User` has 2 colns, user_id (int,pk) and name (char)
`Logins` has 3 colns, `logins_id` (int,pk), `user_id` (int) and `connecttime` (datetime).

Every user has a single entry in `User` and zero or more entries in `Logins`. What is the smallest number of SQL statements to be able get the top 2 (or fewer) connecttime entries from `Logins` for each user_id?

BTW: I'm on MySQL V4.1.12a-nt

Options: ReplyQuote


Subject
Written By
Posted
Help with SQL statement
August 12, 2005 05:33AM
August 12, 2005 05:47AM
August 12, 2005 06:11AM
August 12, 2005 06:35AM
August 12, 2005 06:52AM
August 12, 2005 05:48AM
August 12, 2005 05:49AM
August 12, 2005 05:50AM
August 12, 2005 05:51AM
August 12, 2005 06:31AM


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.