是否有像ISNULL()或COALESCE()類似的東西,但不是檢查空值,而是檢查空值。ISNULL等於空字段
例如:
SELECT cu.last_name, cu.first_name, cu.email, hu.email FROM
(SELECT DISTINCT c.first_name, c.last_name, c.email, c.household_id, h.head_of_household_id
FROM rd_customers c
JOIN rd_households h ON c.household_id = h.household_id
JOIN ad_registrations r ON r.customer_id = c.customer_id
JOIN ad_meeting_times a ON r.session_id = a.session_id and a.meeting_time_id = 203731) cu
LEFT JOIN rd_customers hu ON hu.customer_id = cu.head_of_household_id
,而不是返回四列,我想拿到三,第三個假設有兩種cu.email或hu.email的值,如果第一個是空的! ISNULL和COALESCE不會在這裏工作我不知道爲什麼
的任意組合是在C#!這可能是有用的。是的,我知道你可以創建一個標量函數,但是如果是本地的,比如ISNULL()等,會更好。希望SQL團隊的MS員工讀取這個=) 但是現在,我們必須手動完成,就像Andomar的回答顯示=/ – Losbear 2013-07-25 13:21:32