且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将日期和时间从不同的MySQL列组合到一个完整的DateTime进行比较?

更新时间:2023-01-13 15:42:58

可以使用mysql CONCAT()函数将两列添加到一起,然后比较他们喜欢这样:

You can use the mysql CONCAT() function to add the two columns together into one, and then compare them like this:

SELECT * FROM `mytable` WHERE CONCAT(`d`,' ',`t`) > '2012-02-01 15:00'