I ran this query:
When i deployed the code i realised it was not given me the needed result. WHAT I WISH TO ACHIVE: GET users WHOOSE email APPEAR IN studentusers and useractivation ON THE CONDITION THAT IT THE EMAIL APPEAR IN useractivation WITH refcomfirm='2' and ON THE GROUNDS THAT IT APPEARS IN studentusers.refemail <3 or studentusers.refemail='' I.e it does not occurr at all. PLEASE HELP
SELECT studentusers.refemail, COUNT( studentusers.refemail )
FROM studentusers
LEFT JOIN useractivation ON studentusers.email = useractivation.email
WHERE useractivation.refcomfirm = '2'
GROUP BY studentusers.refemail
HAVING COUNT( studentusers.refemail ) <3
LIMIT 0 , 500
I have a table studentusers (Holds all users) Another useractivation (holds all useractivation)
Common column for both is the email
I wish to display only emails that appear in the studentusers.refemail column less than 3 time and must have useractivation.refcomfirm set to 2
But if you look at the image below you will notice that the email akaakapurity@gmail.com appeard.
When i ran a search on akaakapurity@gmail.com it return 3 rows meaning it appeard 3 time.
See image
It return three rows
I only wish to display emails that appear in both table but appear in in refemail less dan three times and in useractivation table has refcomfirm set as 2
I hope this is clear enough. thanks for the hel