A和B两个表
触发器里这样写
update [ICStockBill
set [FHeadSelfB0436]=
(select case count(*) when 0 then '都是0' else '都是85' end
from [ICStockBillEntry]
where [ICStockBillEntry].[FInterID]=(select [FInterID] from inserted) and [FSourceTranType]<>85 group by [FSourceTranType])
where [ICStockBill].[FInterID]=(select [FInterID] from inserted)
A,B两个表里都有FInterID.根据A表里的FInterID查找B表里的FInterID字段,然后再判断FSourceTranType这个字段是不是都是85.
如果都是85就返回 是,否则就返回否.
我这样如果是就返回都是85,如果否就返回的时空值.
大神门帮看看