Can someone help me with this pretty simple query?
Some of you may know that I just can't get the hang of joins - they require masses of mental effort on my part and I'm pretty burned out at the moment so this is just not happening for me.
Here's the gist of what I am trying to do.
I have 3 tables
pages - contains main info for a page on the site
suppContent - contains extra info that may appear on pages within the site
pageToSuppContentId - contains info to map suppContent to Pages. It maps pageId to suppContentId
I know the pageId and I need to get the correct suppContent Row based on the pageId mapped against it in the suppContentToPage table
So I look up the suppContentId in the pageToSuppContentId table
I can then use this suppContentId to lookup the data from the suppContent table
How can I combine this into a single query?
<honk>*:O)</honk>
Earl & Thompson Marketing - Marketing Agency Services in Gloucestershire
Some of you may know that I just can't get the hang of joins - they require masses of mental effort on my part and I'm pretty burned out at the moment so this is just not happening for me.
Here's the gist of what I am trying to do.
I have 3 tables
pages - contains main info for a page on the site
suppContent - contains extra info that may appear on pages within the site
pageToSuppContentId - contains info to map suppContent to Pages. It maps pageId to suppContentId
I know the pageId and I need to get the correct suppContent Row based on the pageId mapped against it in the suppContentToPage table
So I look up the suppContentId in the pageToSuppContentId table
Code:
SELECT ptsc.suppContentId FROM pageToSuppContentId ptsc WHERE ptsc.pageId = <page_id>
Code:
SELECT sc.* FROM suppContent sc WHERE sc.id = <suppContentId>
<honk>*:O)</honk>
Earl & Thompson Marketing - Marketing Agency Services in Gloucestershire