我想选择所有昨天创建内容的成员
TABLE用户
userid firstname lastname
1 JOHN DEO
2 JANE DEO
表格信息
msg_id msg_from msg_to received age city country timestamp
1 userid(1) userid(2) null 26 any any 2018-10-04 14:37:12
查询
SELECT
SND.userid,
SND.firstname,
SND.lastname,
M.age,
M.city,
M.country
FROM
msg as M
LEFT JOIN users as SND ON SND.userid = M.msg_from
WHERE
M.timestamp >= (CURDATE() - INTERVAL 1 DAY);
我想选择所有昨天创建内容的成员
答案 0 :(得分:0)
尝试一下:
SELECT SND.userid,
SND.firstname,
SND.lastname,
M.age,
M.city,
M.country
FROM msg as M
LEFT JOIN users as SND ON SND.userid = M.msg_from
WHERE M.timestamp >= ( CURDATE() - INTERVAL 1 DAY );
您需要与表别名保持一致。
附注:我没有检查您查询的WHERE子句。
答案 1 :(得分:-1)
终于解决了。我对整个查询和表都有疑问