I use mySQL, and I have a member table with a BLOB "contacts" field containing a list of other member identifiers, separated by commas:
TABLE members: id_member = 1 firstname = 'John' contacts (BLOB) = '4,6,7,2,5'
I want to get all the first names in the contact list of an individual user with one request. I tried the following:
SELECT firstname from members WHERE id_member IN ( SELECT contacts FROM members WHERE id_member = 1 );
It returns only one row, but when I try:
SELECT firstname from members WHERE id_member IN ( 4,6,7,2,5 );
It returns all the first names from the list. I can use two queries to achieve this, but I thought I'd check twice if there is a way to make it work with one simple, elegant query.
Thanks for reading, any help appreciated. July
source share