我数据库中有两张表:type和budget
当type.subdiv=budget.subdiv时
比较对应的type.stat和budget.budget的值
如果type.stat比budget.budget大,在budget.case相应位置中记True;否则记False 我该怎么做?
当type.subdiv=budget.subdiv时
比较对应的type.stat和budget.budget的值
如果type.stat比budget.budget大,在budget.case相应位置中记True;否则记False 我该怎么做?
from budget,[type]
where budget.subdiv = [type].stubdiv
update budget
set case = case when type .stat > budget.budget then true else false end from budget, type
where budget.subdiv = type.stubdiv
update a
set a.[case] = case when b .stat > a.budget then true else false end from budget a, [type] b
where a.subdiv = b.stubdiv
如果[case] 字段是字符型:[code=SQL]
update a
set a.[case] = case when b .stat > a.budget then 'true' else 'false' end from budget a, [type] b
where a.subdiv = b.stubdiv[/code]
update budget,type
set budget.case = IIf(type .stat > budget.budget,'true','false')
where budget.subdiv = type.stubdiv
不行就改成:update budget,type
set budget.case = IIf(type .stat > budget.budget,''true'',''false'')
where budget.subdiv = type.stubdiv
set budget.case = IIf(type .stat > budget.budget,'true','false')
where budget.subdiv = type.stubdiv报'.','!'或'()'使用非法
update budget,type
set budget.[case] = IIf([type .stat]> [budget.budget],"true","false")
where budget.subdiv = type.stubdiv