-2
我有兩個表。如果在表格中的百分比爲null,則我想看看它在表B中SQL Server:是列值爲空從另一個表中獲得列
SELECT
t.id,
CASE
WHEN t.percentage IS NULL
THEN (SELECT percentage FROM test2 AS s WHERE s.id=t.id)
ELSE t.percentage
END AS percentage
FROM
[project_percentage] t
[SQL的可能的複製 - 從另一個表中獲取價值,如果列爲空](http://stackoverflow.com/questions/31195207/sql-get-value-from-another-table-if-column-is-null) –