MySQL Forums
Forum List  »  Newbie

Specifying multiple WHERE options within a group?
Posted by: Callum Macdonald
Date: June 27, 2005 01:07PM

I'm looking to list the number of Users who have an entry matching "Page View" in the table UserActions. The query I'm using is:

SELECT COUNT(*) AS Download_Ruequests FROM (SELECT * FROM UserActions, (SELECT * FROM UserActions WHERE Action LIKE "View%" GROUP BY UserID) AS Users WHERE UserActions.Action = "Request Download" GROUP BY UserActions.UserID) AS Downloads;

However, it involves 2 subqueries and I can't help but feel there must be a simpler way...

I want to return users who have viewed a page AND requested a download, but each of these actions is in a different row in the table. So I'm effectively saying, show me the User IDs which have this action and another action in a different row.

Any pointers greatly appreciated.


Options: ReplyQuote

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.