"select STCD sum(isnull(DRP,0)) as DRP from ST_PPTN_R where between tm='"+DTPicker1.Value+""+text1.Text+ " ":00:00"'and tm='"+DTPicker1.Value+""+text2.text+" ":00:00"'"错在 那里?

解决方案 »

  1.   

    select STCD, sum(isnull(DRP,0)) 
      

  2.   


    "select STCD,sum(isnull(DRP,0)) as DRP from ST_PPTN_R where between tm='"+DTPicker1.Value+" "+text1.Text+ ":00:00"'and tm='"+DTPicker1.Value+" "+text2.text+":00:00"'"
      

  3.   


    "select STCD sum(isnull(DRP,0)) as DRP from ST_PPTN_R where between tm='"
    +DTPicker1.Value+" "+text1.Text+":00:00' and
    tm='"+DTPicker1.Value+" "+text2.text+":00:00'"
      

  4.   

    在使用聚合函数时,查询的数据如果只有聚合函数就不需要groupby,有其他列时一定要加在group by 后面
    "select STCD sum(isnull(DRP,0)) as DRP from ST_PPTN_R where between tm='"
    +DTPicker1.Value+" "+text1.Text+":00:00' and
    tm='"+DTPicker1.Value+" "+text2.text+":00:00'" group by STCD 
      

  5.   

    列和列之间是需要加逗号隔开的"select STCD,sum(isnull(DRP,0)) as DRP from ST_PPTN_R where between tm='"
    +DTPicker1.Value+" "+text1.Text+":00:00' and
    tm='"+DTPicker1.Value+" "+text2.text+":00:00'" group by STCD 
      

  6.   

    在vb6.0中 提示缺少结束语,错误指在group,那里还 有 错?
      

  7.   

     where between 中间连个字段名都没有?
      

  8.   

    "select
     STCD sum(isnull(DRP,0)) as DRP 
    from
     ST_PPTN_R 
    where
     between tm='"
      +DTPicker1.Value+" "+text1.Text+":00:00' 
    and
      tm='"+DTPicker1.Value+" "+text2.text+":00:00'"
      

  9.   


    "select STCD sum(isnull(DRP,0)) as DRP 
     from ST_PPTN_R 
     where tm between '"+DTPicker1.Value+" "+text1.Text+ ":00:00"' and '"+DTPicker1.Value+" "+text2.text+":00:00'"
      

  10.   

    在vb6.0中 提示缺少结束语,错误指在group,那里还 有 错?
      

  11.   

    select STCD, sum(isnull(DRP,0)) as DRP from ST_PPTN_R where tm
     between '"+DTPicker1.Value+""+text1.Text+ " ":00:00"'and
     '"+DTPicker1.Value+""+text2.text+" ":00:00"'
      

  12.   


    "select STCD sum(isnull(DRP,0)) as DRP from ST_PPTN_R where tm between '"+DTPicker1.Value+" "+text1.Text+ ":00:00'and '"+DTPicker1.Value+" "+text2.text+":00:00'"
    改为这个试试,你写的Between语法不对,应该是 [Column] Between [value1] And [value2] 的格式,然后你可以在程序中输出一下你的SQL语法,然后到查询分析器检查一下