我目前正在建设一个棒球网站。 在页面的一侧,我想显示下一场即将到来的比赛的信息。 我正在使用MySQL版本。 5.0.45。 我的桌子是这样建造的:
反对团队,日期,时间,得分
日期是以mysql日期格式(yyyy-mm-dd) 我找到了datediff(date1,date2)命令,并试图用这个方法尝试一下,但没有运气我尝试过如下查询:
SELECT * FROM schedule WHERE MIN(DATEDIFF(CURDATE(),date)) 但是这给了我一个恐惧,因为我正在使用MIN()函数 我对mysql仍然很陌生,我似乎无法弄清楚这一点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
Date is in the mysql date format (yyyy-mm-dd) I have found the datediff(date1,date2) command and tried experimenting with this with no luckI have tried queries such as:
SELECT * FROM schedule WHERE MIN(DATEDIFF(CURDATE(),date)) But this gives me an arror because I am using the MIN() function wrong I am still pretty new to mysql and I just can not seem to figure this out最满意答案
如果你想显示下一个游戏(包括今天),你可以使用以下内容:
SELECT * FROM `schedule` WHERE `date` >= CURDATE() ORDER BY `date` LIMIT 1;如果你想显示所有即将到来的游戏使用:
SELECT * FROM `schedule` WHERE `date` >= CURDATE() ORDER BY `date`;If 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`;你如何从桌上得到下一个即将到来的日期?(How do you get the next upcoming date from a table?)我目前正在建设一个棒球网站。 在页面的一侧,我想显示下一场即将到来的比赛的信息。 我正在使用MySQL版本。 5.0.45。 我的桌子是这样建造的:
反对团队,日期,时间,得分
日期是以mysql日期格式(yyyy-mm-dd) 我找到了datediff(date1,date2)命令,并试图用这个方法尝试一下,但没有运气我尝试过如下查询:
SELECT * FROM schedule WHERE MIN(DATEDIFF(CURDATE(),date)) 但是这给了我一个恐惧,因为我正在使用MIN()函数 我对mysql仍然很陌生,我似乎无法弄清楚这一点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
Date is in the mysql date format (yyyy-mm-dd) I have found the datediff(date1,date2) command and tried experimenting with this with no luckI have tried queries such as:
SELECT * FROM schedule WHERE MIN(DATEDIFF(CURDATE(),date)) But this gives me an arror because I am using the MIN() function wrong I am still pretty new to mysql and I just can not seem to figure this out最满意答案
如果你想显示下一个游戏(包括今天),你可以使用以下内容:
SELECT * FROM `schedule` WHERE `date` >= CURDATE() ORDER BY `date` LIMIT 1;如果你想显示所有即将到来的游戏使用:
SELECT * FROM `schedule` WHERE `date` >= CURDATE() ORDER BY `date`;If 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`;
发布评论