sql 測試記錄 sql server 2005and sql server 2000 1.unionandunionall select't1','t2' union select't1','t2' union select't3','t1' union select't4','t1' union select'T1','T2' --結果得到:3條 T1 T2 t3 t1 t4 t1 --union 會過濾掉重複數據 --如果數據相同,只取最后一組 --union all 則顯示全部 2.count selectcount(a) from( selectnullas a,'t1'as b union select't1',null) as t --此查詢結果為 1 --因為過濾掉null值數據 --下面sql 則顯示2 selectcount(*) from( selectnullas a,'t1'as b union select't1',null) as t