我有一个表结构如下
   金额   账户
   100    现金
   200   农行卡
   300   现金我想得到现金的汇总查询结果
   总金额   账户
   400     现金但是我SQL语句写:select 帐户,sum(金额)as 收入总额 from Income where 账户类别=现金 group by 账户类别; 怎么老是报错,应该怎么写呢

解决方案 »

  1.   

    select 帐户,sum(金额)as 收入总额 from Income where 账户=现金 group by 账户;刚才上面说错了,请问高手应该如何写SQL语句呢
      

  2.   


    //表的字段名只有-账户,而没有账户类别
    select 帐户,sum(金额) as 收入总额 from Income where 账户=现金 group by 账户;
      

  3.   


    SQL.Text := 'select 帐户,sum(金额)as 收入总额 from Income where 账户='+QuotedStr('现金')+' group by 账户'; 
      

  4.   

    select 帐户,sum(金额)as 收入总额 from Income where 账户类别='现金'
      

  5.   


    SQL.Text := 'select 帐户, sum(金额) as 收入总额 from Income where 账户=''现金'' group by 账户'
      

  6.   


    select 帐户,sum(金额)as 收入总额 from Income 
    where 账户='现金'
     group by 账户;