我想根据感兴趣的用户位置获取事件,并留下用户不感兴趣的事件。我也试过但没有得到确切的事件数据。 根据此查询,如果uninterested_event表中没有记录,则不从表中获取记录。
> SELECT * FROM `event` e JOIN `user_interested_location` uil ON
> e.`city` = uil.`city` AND uil.`user_id` = 'A' JOIN
> `uninterested_event` ue ON e.`event_id` != ue.`event`
> AND ue.`user_id` = 'A' WHERE e.`start_date` >= '2018-04-14' ORDER BY
> e.`start_date` ASC
--------------------
Event table
--------------------
event_id | event_name | city | start_date
event_1 | event1 | kanpur | 2018-04-15
event_2 | event2 | Noida | 2018-04-20
event_3 | event3 | Delhi | 2018-04-14
event_4 | event4 | Kanpur | 2018-04-17
--------------------------------
user_interested_location table
--------------------------------
user_id | city |
A | kanpur |
B | Noida |
A | Noida |
-----------------------------
uninterested_event table
-----------------------------
user_id | event_id |
A | event_1 |
B | event_2 |
------------------------------
output (user_id for A)
------------------------------
event_id | user_id | city | start_date
event_4 | event4 | Kanpur | 2018-04-17
event_2 | event2 | Noida | 2018-04-20
答案 0 :(得分:1)
试试这个:
loadData()