Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ChrisF79
Starting Member
1 Post |
Posted - 2005-11-04 : 10:50:51
|
| Greetings,I am very new to SQL and I need help with a select statement. I have two tables:articles--------idtitlesummarydatepostedviews-----ipidtypeI 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.datepostedFROM articlesORDER BY articles.dateposted DESCLIMIT 0,10That 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! |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-05 : 00:36:20
|
| Post your question at MySQL forum of www.Dbforums.comMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|