I need to select the memberid
where count of logins
is greater than 10
I wrote this query:
SELECT COUNT(DISTINCT(member.member_id))
FROM member
LEFT JOIN location_member ON (member.member_id = location_member.member_id)
WHERE Month(FROM_UNIXTIME(member.r_date)) = 11
AND Year(FROM_UNIXTIME(member.r_date)) = 2011
AND FROM_UNIXTIME(member.r_date, '%d') = 28
AND member.pc_address_validated <> 1
**OR (if checkins > 10)**
How can I check if the count is more than 10?
SELECT memberId
FROM checkin
GROUP BY memberId
HAVING COUNT(1) > 3
To address your new query:
SELECT member.member_id
FROM member
INNER JOIN checkins ON member.member_id = checkins.member_id
LEFT JOIN location_member ON (member.member_id = location_member.member_id)
WHERE Month(FROM_UNIXTIME(member.r_date)) = 11
AND Year(FROM_UNIXTIME(member.r_date)) = 2011
AND FROM_UNIXTIME(member.r_date, '%d') = 28
AND member.pc_address_validated <> 1
GROUP BY member.member_id
HAVING COUNT(1) > 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With