[thelist] mysql join and subqueries

Matt Warden mwarden at gmail.com
Sat Jun 4 18:50:05 CDT 2005

> SELECT logins.member_id, count(*) AS logincount
>    FROM logins INNER JOIN profile
>      ON logins.member_id = profile.member_id
>    WHERE city = 'vancouver' AND category_id = '0' AND
>      profile_data LIKE '%three%'
>    GROUP BY logins.member_id
>    ORDER BY logincount DESC
>    LIMIT 0, 20


I believe the city field is in the members table, so the join with
members is required.

Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list