Wasim A. Wasim A. - 1 year ago 126
MySQL Question

MYSQL Concat not working


UPDATE profile SET
favourties=CONCAT(favourties,"123")
WHERE id=1


i want to append 123 in favourties but if default value of favourties is set to NULL then this query will not work. What will be query if favourties is set to NULL and then append 123 with it

Answer Source
UPDATE profile SET favourties=CONCAT(IFNULL(favourties, ''),"123") WHERE id=1