AGGIORNATO CAST
a 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
Esempio di output:
| ID | USER | ... | REALBODY | ---...------------------------ | 2 | 2 | ... | Post 2 | | 1 | 1 | ... | Post 1 |
Ecco SQLFiddle demo