I am using MySQL and have a table (documentShips) that I want to store connections / links between documents and users.
- The users table has columns including id, first_name and last_name etc...
- The documents table has columns including id and users, where the users column contains a comma separated value
- E.g. "Joe Bloggs, Fred Nerk, Simon McCool" etc...
I want to match users between the tables (documents and users) using a like statement, e.g.:
where documents.authors like '% users.last_name %'
and insert them into the documentShips table, e.g.:
insert into documentShips (user_id, document_id) ... values () ... where ...
I am struggling to create a valid (mysql) insert statement to do this.
Any help would be greatly appreciated !!!
Thanks, Jon.