I am currently working on building a baseball website. On one side of the page I want to display information on the next upcoming game. I am using mysql ver. 5.0.45. My table is built as so:
opposingTeam, date, time, score
I have tried queries such as:
SELECT *
FROM schedule
WHERE MIN(DATEDIFF(CURDATE(),date))
MIN()
function wrongIf you want to display the next game (including today) you can use the following:
SELECT * FROM `schedule` WHERE `date` >= CURDATE() ORDER BY `date` LIMIT 1;
If you want to display all upcoming games use:
SELECT * FROM `schedule` WHERE `date` >= CURDATE() ORDER BY `date`;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With