我现在要SQL数据库中有一个表,表中的数据:
 ID     姓名
  1      A
  2      B
  3      C
  4      D
  .
  .
  .
  1000     FFFFF有这么一个表,现在我要删除表中ID大于60和ID小于20的数据。
请问用什么语句。

解决方案 »

  1.   

    DELETE *FROM TABLE WHERE ID>60 AND ID<20
      

  2.   

    请大家再看看这条语句
    int m_a=20;
    int m_b=60;
    m_oper.Format("use NewDatabase DELETE FROM "+m_talenamestr[i]+" WHERE (ID<("m_a"))and (ID>("m_b"))");
    这一条报错啊,用VC++怎么表示,求正确方法。
      

  3.   

    ID <("m_a")为什么要用""号 
      

  4.   

    m_oper.Format("use NewDatabase DELETE FROM %s WHERE (ID <%d)and (ID>%d)",m_talenamestr[i],m_a,m_b); 
      

  5.   

    基础问题啊,既然用了format,就要知道用%s与字符串变量匹配或者%d与整型变量相匹配。。
      

  6.   

    and 不行,要OR
    ----------------------------------------------- 
    http://www.wantsoft.com 
    隐形者软件代码交流博客 
    -----------------------------------------------
      

  7.   

    CString str;
    str.Format("DELETE FROM %s WHERE ID>%d OR ID <%d", m_talenamestr[i], m_a, m_b)
    //DELETE * 是什么语句?
      

  8.   

    1.
    Delete from,没有*
    2.
    用Or而不是and