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`.`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`
|
||||
|
Loading…
Reference in New Issue
Block a user