サブクエリで親クエリ列をどのように参照しますか? これが私のクエリです
SELECT
c.username, c.staff_of, CONCAT(c.first_name, ' ', c.middle_name, ' ', c.last_name ) AS csr,
d.date, d.account, d.total_transaction, d.total_participate, d.total_amount,
(SELECT COUNT(id) FROM users WHERE created_by = c.username ) AS total_agents
FROM `users` c,
(SELECT
DATE(res_date) AS date, B.res_account AS account,
COUNT(B.res_id) AS total_transaction,
COUNT(DISTINCT(B.res_account)) AS total_participate,
SUM(B.res_amount) AS total_amount
FROM
merchant_responses B
WHERE B.res_account IN (SELECT t.staff_of FROM users t WHERE t.created_by = c.username)
) AS d
WHERE c.account_type ='DSO' GROUP BY c.username
これが得られた結果です
#1054 - Unknown column 'c.username' in 'where clause'
サブクエリで c.username を表示するにはどうすればよいですか?
事前にサンクス