SQL在Isnull列上使用Where

时间:2017-09-22 15:55:50

标签: sql

我有

Dim sheet As Worksheet

Set sheet = ActiveSheet

' this hides the sheet so that it can only be made visible using VBA
sheet.Visible = xlSheetVeryHidden
ActiveWorkbook.Sheets("Admin").Visible = xlSheetVeryHidden
Worksheets("sheet1").Activate
ActiveWorkbook.SaveCopyAs Filename:=ActiveWorkbook.Path & "\MyReport - " & Format(Date, "mm-dd-yyyy") & ".xlsm"

在使用isnull时,我不确定在按供应商名称过滤的位置。

1 个答案:

答案 0 :(得分:2)

由于没有实际的Supplier列,请将过滤条件放在isnull(s1.column, s.column)表达式上:

SELECT
ISNULL(s1.column, s.column) Supplier
FROM MyTable
WHERE ISNULL(s1.column, s.column) = 'DesiredValue'