I would like to do a simple select - but the condition is a bit tricky for me (because I'm a SQL-beginner).
I got this table:
userid | email | newsletters
1 | test@example.com | 1,2
2 | test2@example.com | 1
Now I would like to get all email-addresses of users, which want to get newsletter "2".
This would be:
email | newsletters
test@example.com | 1,2
And of course: In another query all users, which are subscribing newsletter number 1:
Result:
email | newsletters
test@example.com | 1,2
test2@example.com | 1
What would be the correct sql-query? I think this should be the right beginning, but I don't know which condition I have to use:
SELECT email FROM users WHERE newsletter CONDITION?
Could you please help me out? :-)
Aucun commentaire:
Enregistrer un commentaire