2 番目のフィールド「e.occured_at」を挿入しようとしたときにこのエラーが発生しました。サブクエリで、このテーブルの両方のフィールドを選択したいのですが、修正する方法はありますか?
SELECT DISTINCT (
inbox_msg.id_conversation
), users.name, users.surname, users.username, n. * , image_upload.name_image, (
SELECT e.message, e.occured_at
FROM inbox_msg e
WHERE e.id_user = inbox_msg.id_user
ORDER BY occured_at DESC
LIMIT 1
) AS last_msg
FROM (
SELECT *
FROM inbox_join
WHERE (
id_user =1 || id_user_2 =1
)
)n
INNER JOIN inbox_msg ON n.id_conversation = inbox_msg.id_conversation
INNER JOIN users ON users.id = inbox_msg.id_user
INNER JOIN image_upload ON image_upload.id_image = users.profile_image
WHERE inbox_msg.id_user <>1
ORDER BY n.occured_at DESC