我有3 张桌子:
Manager: manager_id, taluka_name
Employee: employee_id, employee_manager_id
Target: target_id, target_employee_id
现在我必须明智地显示所有目标taluka_name的 ListView 。我正在使用 greenDao 与 SQlite 数据库进行交互。
这是我尝试过的过程,使用我使用的方法花费的时间太长:
Step1: Get Manager ID for the taluka name from the DB.
Step2: Get Employee for the Target table->Employee ID.
Step3: Get Manager ID from the Employee table.
Step4: Compare if Both Manager ID are equal {if YES then target
belongs to that taluka}
以下是我想使用 Greendao 完成的查询类型
SELECT *
FROM target t, location l, current c
WHERE t.target_location_id = l.location_id
AND t.target_location_id = c.school_id
AND t.target_status <> '0'
AND t.target_status <> '4'
AND DATEDIFF(NOW(),t.target_exec_end_time)<7