Greetings,
I have done a search through these forums, as well as Google but cannot seem to find the answer to what I think is a relatively simple problem.
I have two tables - one stores news articles (table 1), while the other stores stats related to how often each article has been viewed (table 2). I want to be able to display a list of articles from Table 1, ordered by the number of times each has been viewed (which is stored in Table 2).
The fields in Table 1 are : ID, title, date, time, section, text, and author.
The fields in Table 2 are : ID, articleID, and stats. ArticleID is the value of ID in Table 1 for each article.
The query to just view the records from Table 1 in date order works and is:
SELECT * FROM table1 WHERE date <= "today" and section = "all" and author = "all" ORDER BY date DESC, time DESC
What I want to be able to do is ORDER BY stats in Table 2. Is this possible? It seems like I should be using a JOIN term to do this, but my efforts have failed thus far.
Thoughts, comments and suggestions all welcome!
Thanks!