I’m working on a project where every time a video is viewed, a row is added into the views table with the video ID and the viewers IP.
I was wondering how I would select the video from the videos table with the largest amount of rows referring to it in the views table.
Example:
VIEWS
Video: 1234 IP: 123.234.456
Video: 1234 IP: 768.346.467
Video: 4321 IP: 123.234.456
VIDEOS
Video: 1234 By: user123
Video: 4321 By: randomuser456
In this situation, I would like the row with video 1234 selected.
Thanks!
How about something like this:
DEMO: http://sqlfiddle.com/#!2/06b48/4