我数据库中有两张表:type和budget 
当type.subdiv=budget.subdiv时 
比较对应的type.stat和budget.budget的值 
如果type.stat比budget.budget大,在budget.case相应位置中记True;否则记False 我该怎么做?

解决方案 »

  1.   

    update [case]= case when [type].stat>budget.budget then true else false end
    from  budget,[type]
    where budget.subdiv = [type].stubdiv
      

  2.   


    update budget
       set case = case when type .stat > budget.budget then true else false end from budget, type
     where budget.subdiv = type.stubdiv
      

  3.   

    报语法错误(操作符丢失)在查询表达式'case when type .stat > budget.budget then true else false end from budget'中
      

  4.   


    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]
      

  5.   

    case 字段是文本仍然说操作符丢失
      

  6.   


    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
      

  7.   

    update budget,type
       set budget.case = IIf(type .stat > budget.budget,'true','false')  
     where budget.subdiv = type.stubdiv报'.','!'或'()'使用非法
      

  8.   


    update budget,type
       set budget.[case] = IIf([type .stat]> [budget.budget],"true","false")  
     where budget.subdiv = type.stubdiv