I have a table tv_programs (prog_id, channel_id, prog_name, prog_start_date, prog_end_date)
I would like to have, for each channel, the very next program that will start after the one being broadcast now. So one row per channel.
I tried
Select * from tv_programs where prog_start_date > NOW()
This gives me all programs for all channels starting after now.
you have to
GROUP BY channel_idso the final query:
will return the program to start the sooner for each channel