I am trying to build a tricky SQL statement and I need some advice.
I have these 2 tables:
         subscribers
| id | name    | email              |
| 1  | John Doe| john.doe@domain.com|
| 2  | Jane Doe| jane.doe@domain.com|
| 3  | Mr Jones| mr.jones@domain.com|
and
         links
| id | campaign_id    | link                                  | id_of_user_that_clicked |
| 1  | 8              | http://somesite.com/?utm_source=news1 | 1,2,3                   |
| 2  | 8              | http://somesite.com/?utm_source=news2 | 1,2                     |
| 3  | 5              | http://somesite.com/?utm_source=news3 | 2                       |
To pull the name and email of Mr. Jones is fast. I run:
SELECT name, email FROM subscribers WHERE id IN ('3')
But I want to add to the result the URL that he clicked stored in the link column of the second table.
I tried to do something similar to:
SELECT name, email FROM subscribers WHERE id IN ('3') LEFT JOIN SELECT link FROM links WHERE (id_of_user_that_clicked LIKE '3')
to no avail
Notice that in the second table, I have the id stored with other id's as well. How can I match subscribers.id with corresponding number in links.id_of_user_that_clicked and have the query display the link next to the name and email.
Any ideas?
 
     
     
     
    