Seperating into categories
Posted: Sun Aug 31, 2008 8:55 am
Hey guys, I have script which associates 'guides' to 'games', then associates the 'guides' to 'categories'.
This query joins the 3 together and SHOULD only return category ids of '1'.
However, for some reason, if i have a guide that's in category '2' when running this query in phpMyAdmin it adds that guide aswell but the category id for it (gcId) is '1' for some reason.
So heres the query:
These are the tables involved:
guidesgamesconnect
guides
Ok so these 2 are absolutely fine, if i didnt want to split these into categories i would have moved on. So now comes the problem.
New table structures
guidescategories
guidescategoriesconnect
I basically want to have 3 queries on the same page separating them into 3 categories.
Thanks for any help in advance
This query joins the 3 together and SHOULD only return category ids of '1'.
However, for some reason, if i have a guide that's in category '2' when running this query in phpMyAdmin it adds that guide aswell but the category id for it (gcId) is '1' for some reason.
So heres the query:
Code: Select all
SELECT guidesgamesconnect.gamesgId, guidesgamesconnect.guidesguId, guides.guTitle, guides.guName, guides.guAuthor, guides.guDate, guides.guVersion, guidescategories.gcName, guidescategories.gcId
FROM guidesgamesconnect, guidescategoriesconnect
LEFT JOIN guides
ON guides.guId = guidesgamesconnect.guidesguId
LEFT JOIN guidescategories
ON guidescategories.gcId = guidescategoriesconnect.guidescategoriesgcId
WHERE guidesgamesconnect.gamesgId = 71 and guidescategoriesconnect.guidescategoriesgcId= 1
Code: Select all
============================================
|guId | guTitle | guName | guAuthor | guDate | guVersion |
============================================
|12 | fgdgsg | 10.txt | dgdfg | 08-30 | fgdfgdfg |
============================================Code: Select all
===================
|gamesgId | guidesguId |
===================
|71 | 12 |
===================Code: Select all
============================================
|guId | guTitle | guName | guAuthor | guDate | guVersion |
============================================
|12 | fgdgsg | 10.txt | dgdfg | 08-30 | fgdfgdfg |
============================================New table structures
guidescategories
Code: Select all
==============
|gcId | gcName |
==============
|1 | general |
|2 | in-depth |
|3 | general |
==============Code: Select all
==========================
|guidesguId| guidescategoriesgcId|
==========================
|12| 1 |
|13| 2 |
==========================Thanks for any help in advance