Get all Date of month along with data from table

后端 未结 3 1003
终归单人心
终归单人心 2020-12-22 00:43

I have two tables user_profile and tracked_search. The user_profile table has user details and tracked_search tracks sear

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 00:59

    You need to write without AND u.id = ts.user_id.

    SELECT ts.created , count( distinct ts.user_id) FROM tracked_search ts, user_profile u
     WHERE ts.created>=(CURDATE()-INTERVAL 1 MONTH) 
     group by ts.created;
    

提交回复
热议问题