Oh man, I just can’t figure out how to write this query.
Any guidance will be highly appreciated.
I have the following tables:
Specification_Title
id
title (e.g. position, design)
Specification_Name
id
name (e.g. left, right)
spec_title_id
Products
id
name (e.g. headlights)
dataEntryUserId
dateOfEntry
Product_Spec_Link
id
specnameid
productid
I want to fetch all the products where
dataEntryUserId = X
dateOfEntry = Y
Which is simple to do with
SELECT * FROM products WHERE dataEntryUserId = "X" AND dateOfEntry = "Y"
But I just can’t figure out how to get the following output
Product Name: Headlight
dataEntryUserId: X
dateOfEntry: “Y”
Specifications: Position (Left), Position (Right)
I am just wondering if this can be done in SQL or do I have to somehow use PHP to store the results of multiple INNER JOIN queries and output it in the final table (which I also can’t figure out).
Can you kindly assist?