Hello, I am trying to create a query for the following scenario, that doesn't take ages and ages to return. Let's assume the following columns in an events table: user_name, event_type, event_time.
I want to select a count of all users which have more than 1 (2 or more) entries in the event table that match event_type 'abc' or 'def' (but not anything else). I also need to say before an arbitrary time. I have used PostgreSQL quite a lot, but I'm not sure how to most efficiently form the query on MySQL. The other question is about index usage. There is currently an index (which I see via show indexes from events) on the user_name column, but it is not being used when I type in a query using that column (i.e. select count(*) from events where event = 'abc' group by user_name). How do I describe just one index in MySQL to see the full details? What is the best way to form this query (I am used to using PostgreSQL and subselects)? What indexes would be the most beneficial to the query suggestion? Thank you for your time, any response appreciated. -- Casey Allen Shobe | http://casey.allen.shobe.info [EMAIL PROTECTED] | ICQ: 1494523 | AIM: SomeLinuxGuy -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]