帮忙写一个SQL语句。Update TBL1
Set Field1=NULL,
Field2 = NULL
FROM TBL2
WHERE TBL1.id=TBL2。id上面这个语句中,需要判断如果 Field1<> NULL and Field2<>NULL的时候,
才将 Field1=NULL, Field2 = NULL。这个SQL如何写?
Set Field1=NULL,
Field2 = NULL
FROM TBL2
WHERE TBL1.id=TBL2。id上面这个语句中,需要判断如果 Field1<> NULL and Field2<>NULL的时候,
才将 Field1=NULL, Field2 = NULL。这个SQL如何写?
Set Field1=NULL,
Field2 = NULL
FROM TBL2
WHERE TBL1.id=TBL2.id and Field1 <> NULL and Field2 <>NULL
Set Field1=NULL,
Field2 = NULL
FROM TBL1 a ,TBL2
WHERE TBL1.id=TBL2.id and a.Field1 is not null and a.Field2 is not null
Set Field1=NULL,
Field2 = NULL
FROM TBL2
WHERE TBL1.id=TBL2.id and (Field1 <> NULL and Field2 <>NULL)
Set Field1=case Field1 when NULL then Field1 else NULL end,
Field2 = case Field2 when NULL then Field2 else NULL end
FROM TBL2
WHERE TBL1.id=TBL2.id
Update TBL1
Set Field1 = NULL,
Field2 = NULL
from tbl1, tbl2
where tb1.Field1 is not null and tb1.Field2 is not null and TBL1.id=TBL2.id
Set Field1=NULL,
Field2 = NULL
FROM TBL2
WHERE TBL1.id=TBL2。id 上面这个语句中,需要判断如果 Field1 <> NULL and Field2 <>NULL的时候,
才将 Field1=NULL, Field2 = NULL。 这个SQL如何写?
---try
Update TBL1
Set Field1=NULL,
Field2 = NULL
FROM TBL2
WHERE TBL1.id=TBL2.id and Field1 is not null and Field2 is not null