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:
parent
613f0c1616
commit
6cfe0a7d8b
@ -3,13 +3,10 @@ SELECT
|
|||||||
`entry`.`created`,
|
`entry`.`created`,
|
||||||
`entry`.`name`,
|
`entry`.`name`,
|
||||||
`entry`.`message`,
|
`entry`.`message`,
|
||||||
CASE
|
`entry`.`website`,
|
||||||
WHEN `entry`.`hide_website` IS FALSE
|
`entry`.`hide_website`,
|
||||||
THEN `entry`.`website`
|
COALESCE(`reply`.`created`, 0) AS `reply_created`,
|
||||||
ELSE ''
|
COALESCE(`reply`.`message`, '') AS `reply_message`
|
||||||
END AS `website`,
|
|
||||||
`reply`.`created` AS `reply_created`,
|
|
||||||
`reply`.`message` AS `reply_message`
|
|
||||||
FROM `entry`
|
FROM `entry`
|
||||||
LEFT JOIN `reply`
|
LEFT JOIN `reply`
|
||||||
ON `entry`.`entry_id` = `reply`.`entry_id`
|
ON `entry`.`entry_id` = `reply`.`entry_id`
|
||||||
|
Loading…
Reference in New Issue
Block a user