Disclaimer: I have searched for similar questions but I haven't found a clear answer to my issue.
I have a table like this:
id | catid | views | text
1 100 2000 "sometext"
2 200 2000 "sometext"
3 200 3000 "longertext"
For each catid (that in this case are just 2: 100 and 200) i need to get the record with the most views and the longer texts... In this case the result would be:
id | catid | views | text
1 100 2000 "sometext"
3 200 3000 "longertext"
With priority on the number of views. I have tried some queries with inner joins but none seems clear and working...
Any thoughts ?