次のサブクエリがあり、エラーがスローされます
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 構文にエラーがあります。21 行目の「from PT_Tutors ts」付近で使用する正しい構文については、MySQL サーバーのバージョンに対応するマニュアルを確認してください。
代わりに結合を使用する必要があるかどうかを確認するために同様の質問を投稿しましたが、サブクエリに戻ってきたので、誰かが私が間違っていることを教えてくれることを願っています.