Help needed on a small SELECT/JOIN statement
Greetings,
I am very new to SQL and I need help with a select statement. I have two tables:
articles
--------
id
title
summary
dateposted
views
-----
ip
id
type
I want to select 10 article summaries per page, shown in descending order, with the number of times that article has been viewed. So far I have:
SELECT articles.id, articles.title, articles.summary, articles.dateposted
FROM articles
ORDER BY articles.dateposted DESC
LIMIT 0,10
That works fine to show me the articles the way I want. However, how do I add the count of the number of times that article has been viewed? I'm guessing it is a join, and I'm guessing there will be a statement in there that says WHERE (articles.id = views.id AND views.type = "article") but that is merely a guess.
Could anybody please help me clear this up? Thanks in advance for any guidance you could provide!
Subject
Views
Written By
Posted
Help needed on a small SELECT/JOIN statement
2527
November 04, 2005 10:23AM
1648
November 04, 2005 11:52AM
1641
November 04, 2005 12:02PM
1664
November 04, 2005 01:11PM
1654
November 04, 2005 01:32PM
1622
November 04, 2005 03:12PM
1352
November 04, 2005 03:19PM
1598
November 04, 2005 12:34PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.