我有以下的子查询,他们抛出一个错误子查询抛出一个错误
select ts.id,(CONCAT(ts.first_name, ' ', ts.last_name),
( select SUM(hours*pay)
from
PTAddedApp aa
where
aa.tutor_id = ts.id
and year(aa.date) = year(now())
and month(aa.date) = month(now())
),
(select SUM(nt.hours*nt.rate)
from PT_NT_Work_Hours nt
where
nt.tutor_id = ts.id
and year(nt.date) = year(now())
and month(nt.date) = month(now())
)
from PT_Tutors ts
我收到以下错误消息。我假设我正在做一些傻事 - 1064 - 你的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以便在第21行'来自PT_Tutors ts'附近使用正确的语法。
我发布了一个类似的问题,看看我是否应该使用连接,他们指出我回到子查询,所以我希望有人能让我知道我做错了什么。
谢谢!那么,我是否因为白痴而失去积分? –
我很确定几乎每个人都发现自己在某些时候对这些错误感到头痛:) – Hazaart