我有两个表'Customer_details'
和'Application_Status'
两个表都有日期,一个where-in
customer_details
表有
注册Date[Format: DD/MM/YYYY (04/12/2018 10:30:00 AM)]
和Application_Status
有
应用Date[Format: YYYY-MM-DD (2018-12-04 04:00:00 PM)]
。
我想将两个日期与当前日期进行比较,并获取两个表数据。
答案 0 :(得分:0)
请尝试此查询。
SELECT *
FROM Customer_details AS cdel
INNER JOIN Application_Status AS asts
ON cdel.c_id = asts.c_id
WHERE cdel.date = CURDATE() AND asts.date = CURDATE();
或者您可以将NOW()
函数用作:
SELECT *
FROM Customer_details AS cdel
INNER JOIN Application_Status AS asts
ON cdel.c_id = asts.c_id
WHERE cdel.date = NOW() AND asts.date = NOW();
注意:
SELECT NOW(); -- You will get 2010-12-09 17:10:18
SELECT CURDATE(); -- You will get 2010-12-09