In writers I have one interesting column: "writerID". Writers.writerID <-> Entries.writerID is as one is to many.
Alright. Third table is the comments table:
EntryID (many to the one in Entries table)
For each post (i.e. for each call to the database) I want to fetch the name of the author/writer from Writers table and count the number of comments in Comments, giving me the columns in the end:
Writer (a string), Category (a string) Comments (in int), EntryID (an int), Entry (as PM/BLOB/TEXT = string), Date (simple: from the Entries table).
I also only want the top five records ordered by date.
So something like:
"SELECT TOP 5 Entries.EntryID, Entries.CategoryID, Entries.Entry, Comments.CommentID , Writers.WriterID, Writers.Name
FROM Entries, Writers, Comments LEFT OUTER JOIN Comments
ON Entries.EntryID = Comments.EntryID AND Entries.WriterID = Writers.WriterID
ORDER BY Date DESC"
but it doesn't really work :s
outer since it ought to display regardless if any comments have been made...