I have a table where I store purchases, and a table where I store products.
Each row in the purchases table can contain up to 9 products ids (8 can be empty)
id, foo, bar, baz, product_1_id, product_2_id, product_3_id, etc...
Now I need to query all the fields of that purchases table, to display in a html page.
I can't display only the products ids, so I need to find the corresponding product_name in the products table.
The SQL query is giving me a hard time.
Any help would be really appreciated.