我很难代表一个查询。我要转换为 SQL 语句的语句是:
select count(*)
from assigned, tasks
where
assigned.id_task = 1
or
(assigned.id_project=tasks.id_project and tasks.id=1)
到目前为止,我成功提出的是:
select count(*)
from assigned a
left join projects p
on p.id=a.id_project
left join tasks t
on t.id_project=p.id
where (a.id_task=1 or t.id=1)
但是,第二个没有返回正确的结果。我错过了什么?