0
比如我在t_shops 3 NOT NULL列:ID,名稱,語言環境。區域設置列的默認值爲「」空字符串。如果where語句不匹配,我需要選擇默認值。我正在嘗試使用COALESCE函數,但它僅適用於NULL列。我有PostgreSQL數據庫。選擇默認值,如果WHERE語句犯規比賽
SELECT locale FROM t_shops WHERE id = '123' locale = 'not what i have in DB'
你好,請問有什麼辦法與連接表,使其?喜歡的東西 SELECT COALESCE(join1,join2) FROM t_products LEFT JOIN t_products join1 ON join1.locale = '不是我有什麼(NULL)' LEFT JOIN t_products join2 ON join2.locale = '默認' –