-4

これは私のクエリです:

SELECT  messages.*, 
        units.*, 
        MAX(messages.created_at) AS 'conversation_date', 
        (select count(*) as messages from messages where unit_id = units.id), 
        WEEKOFYEAR(MAX(messages.created_at)) as 'woy', 
        YEAR(MAX(messages.created_at)) as 'year',
        classifications.description AS 'classification'
FROM    messages 
JOIN    units ON units.id = messages.unit_id
JOIN    classifications ON units.classification_id = classifications.id
WHERE   from_id <> units.creator_id GROUP BY messages.unit_id, from_id, to_id

4 番目の列に名前を付けようとしています"messages"が、その名前は文字どおりに戻ってきます"(select count(*) as messages from messages where unit_id = units.id)"

私は何を間違っていますか?

4

1 に答える 1