Hi all,
On a website i own there is the posibility to post reactions to newsitems.
On my main page i would like to show the three newsitems who had the latest reactions.
Here is some information about the database:
Table
news has the followinf fields:
-Newsid
-Title
-Message
-Date
I aslo have a table
News_reactions wich holds the following fields:
-newsid
-reactionid
-datetime
-reaction
i would like to display the last three newsitems that had a reaction.
When i do
Code:
select newsid from news_reaction order by datetime DESC limit 3
I get the three last reactions,.. but it is possible that those are made to the same newsid
When i do
Code:
select distinct(newsid) from news_reaction order by datetime DESC limit 3
i get three different newsid's as expected, but the are not in the right order! The seem to apear in some random order, or in order of newsid, but not in order of who had the last reaction.
Can anyone help me with this?
I hope my question is clear, please ask for more specific deatils if neccesary