I am using a MySQL DB and I'm trying to combine my results. my SQL Chops aren't experienced enough to come up with a way to accomplish this.
the Picture explains my objective and db structure. https://i.sstatic.net/x6dCo.png
this is what I was Using:
SELECT
LISTITEMS.ID,
LISTITEMS.ItemName,
PROPVALUE.PropValue,
LISTPROPERTIES.PropName
FROM LISTITEMS
INNER JOIN PROPVALUE
ON LISTITEMS.ID = PROPVALUE.ItemID
INNER JOIN LISTPROPERTIES
ON LISTPROPERTIES.ID = PROPVALUE.PropID
WHERE LISTITEMS.ListID = '$_GET[ID]'
this Returns 2 rows and I need 1 row (I edited out the 'ID' columns from the other 2 tables).
ID ItemName PropValue ListID PropName
1 item 1 PropValue1 1 Property1
1 item 1 PropValue2 1 Property2
Edit Desired output:
ID ListID ItemName PropName1 PropValue1 PropName2 PropValue2
1 1 Item 1 Property1 PropValue1 Property2 PropValue2
PropValueandPropNamediffer. Please post an example of how you want the output to look.$_GET['ID']is a proper integer. Otherwise, your query is vulnerable to SQL injection...)