I need to join this mySQL table:
TABLE1
id pagetitle
1 remodeling
2 handywork
3 aesthetics
With this one:
TABLE2
id contentid tmplvarid value
1 1 1 Jaime
2 1 2 img/remodeling.jpg
3 2 1 Alex
4 2 2 img/handywork.jpg
5 3 1 Karla
6 3 2 img/aesthetics.jpg
To output this:
id pagetitle author image
1 remodeling Jaime img/remodeling.jpg
2 handywork Alex img/handywork.jpg
3 aesthetics Karla img/aesthetics.jpg
Note: The relation between Table1 and Table2 is: Table1.id = Table2.contentid
If it helps …tmplvarid 1 is author and tmplvarid 2 is image
What is the SQL query I can use to accomplish this?
1 Answer