Associate
- Joined
- 15 Apr 2008
- Posts
- 1,031
- Location
- West Didsbury, Manchester
Ok, joins are my pet hate. I cannot get my head round them no matter how much I read. I keep trying and one day I know they will click, but today isn't that day. So I need some help with this query.
What I have:
What I think is my line of issue:
wiki_pageTypeDefinitions will always have a definition of a wiki page which includes 'header' however it may not always have it's corresponding value from wiki_pageContent.content.
So, what I need is a join of some sort which will always return the header, and if it doesn't find the corresponding content then just return nothing. At the moment it works perfectly as long as the header has its corresponding content, otherwise it doesn't return the row at all, obviously because it evaluate the "==" to true.
If you need any more info or further explanation i can try explaining again. Thanks for reading I really am at my wits end with this!!!!
What I have:
Code:
$query = "SELECT
wiki_pageContents.content,
wiki_pageTypeDefinitions.heading
FROM
wiki_pageTypeDefinitions,
wiki_pageContents
WHERE
wikiPageTypeID = '".$data['wikiPageTypeID']."' AND
wiki_pageContents.wikiPageTypeDefinitionID = wiki_pageTypeDefinitions.wikiPageTypeDefinitionID
ORDER BY
headingOrder ASC";
What I think is my line of issue:
Code:
wiki_pageContents.wikiPageTypeDefinitionID = wiki_pageTypeDefinitions.wikiPageTypeDefinitionID
wiki_pageTypeDefinitions will always have a definition of a wiki page which includes 'header' however it may not always have it's corresponding value from wiki_pageContent.content.
So, what I need is a join of some sort which will always return the header, and if it doesn't find the corresponding content then just return nothing. At the moment it works perfectly as long as the header has its corresponding content, otherwise it doesn't return the row at all, obviously because it evaluate the "==" to true.
If you need any more info or further explanation i can try explaining again. Thanks for reading I really am at my wits end with this!!!!