Gossamer Forum
Home : Products : Gossamer Links : Discussions :

MySQL-Query for showing links from one category?

Quote Reply
MySQL-Query for showing links from one category?

since a fiew days i'm thinking of using a mySQL-Query to get links from one subcategory displayed - anything like the following (i know that this wouldn't work!) :

SELECT * FROM Links,Category WHERE fatherID='55'

Links SQL is saving the Relationship between an entry and the choosen category in the table 'CatLinks' - there's the actual category for an entry saved - that's my knowhow til yet ;)

I know how to create queries for one table, but how do i create a query in relationship to other tables?

It wouldbe great if anyone could post a sample, where i could learn from.


Quote Reply
Re: MySQL-Query for showing links from one category? In reply to
left/inner joins like the following example:


CatLinks INNER JOIN Links ON CatLinks.LinkID = Links.LinkID
LEFT JOIN Category ON CatLinks.CategoryID = Category.CategoryID
WHERE CategoryID = '55';

I believe that CategoryID needs to be changed to FatherID.

Couple Suggestions:

1) Buy a MySQL for Dummies or SQL for Dummies book.
2) Search the http://www.mysql.com for relevant documents.


Eliot Lee