1
0

Return both website and hide_website fields (for use on an admin page). Using COALESCE to return 0 and an empty string if there is no reply to not deal with NULL.

This commit is contained in:
Alexander Andreev 2023-05-09 21:30:17 +04:00
parent 613f0c1616
commit 6cfe0a7d8b
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -3,13 +3,10 @@ SELECT
`entry`.`created`,
`entry`.`name`,
`entry`.`message`,
CASE
WHEN `entry`.`hide_website` IS FALSE
THEN `entry`.`website`
ELSE ''
END AS `website`,
`reply`.`created` AS `reply_created`,
`reply`.`message` AS `reply_message`
`entry`.`website`,
`entry`.`hide_website`,
COALESCE(`reply`.`created`, 0) AS `reply_created`,
COALESCE(`reply`.`message`, '') AS `reply_message`
FROM `entry`
LEFT JOIN `reply`
ON `entry`.`entry_id` = `reply`.`entry_id`