select * from ( select uid ,min(date(in_time)) dt from tb_user_log group by uid) as t1 left join (select uid , date(in_time) dt from tb_user_log union select uid , date(out_time) from tb_user_log) as t2 语法检查
时间: 2024-04-08 12:34:53 浏览: 104
日期时间选择
这个SQL语句会检查语法是否正确。以下是经过修正的查询语句:
```sql
SELECT *
FROM (
SELECT uid, MIN(DATE(in_time)) AS dt
FROM tb_user_log
GROUP BY uid
) AS t1
LEFT JOIN (
SELECT uid, DATE(in_time) AS dt
FROM tb_user_log
UNION
SELECT uid, DATE(out_time)
FROM tb_user_log
) AS t2;
```
请注意,这个查询会从 `tb_user_log` 表中选择每个用户的最早登录日期,并将其与所有登录和登出日期进行联接。
阅读全文