UPPDATERAD CAST
det till CHAR
SELECT `posts`.*, CAST(AES_DECRYPT(`posts`.`body`,SHA2(CONCAT('prefix',`users`.`guid`,'suffix'),512)) AS CHAR) as 'realbody'
FROM `posts` JOIN `users`
ON `posts`.`user` = `users`.`id`
ORDER BY `posts`.`id` DESC
Exempelutdata:
| ID | USER | ... | REALBODY | ---...------------------------ | 2 | 2 | ... | Post 2 | | 1 | 1 | ... | Post 1 |
Här är SQLFiddle demo