Help creating this query
SELECT m.id,m.seen, m.uid, m.hash, m.date_created,m.subject,
m.textplain,m.texthtml, CONCAT_WS('@', a.localpart, a.domain ) 
AS address,COUNT(child.id) AS child_count 
FROM messages m 
INNER JOIN messages child ON child.parent_id = m.id
LEFT JOIN message_address_fields maf ON maf.message_id = m.id 
LEFT JOIN addresses a ON a.id = maf.address_id 
WHERE maf.field_id =4 AND m.user_id =1 LIMIT 0 , 30