有一个字段叫studentnum(学号)我想查出学生学号前7位为0203001的所有学生。请问应该怎么写,我这么写有什么错误吗?
select * from student where copy(studentnum,1,7)=0203001.
请大家给个正确的写法,谢谢!

解决方案 »

  1.   

    select * from student where copy(studentnum,1,7)='0203001'
      

  2.   

    试一下,用下面的查询语句:
    sql.text:='select * from student where substring(ststudentnum,1,7)='''+'0203001'+''''
      

  3.   

    简单的话,也可以这样吧select * from student where ststudentnum LIKE '0203001%'
      

  4.   

    想查出学生学号前7位为0203001的所有学生
    应该按 cangwu_lee(小橙子) 
    select * from student where ststudentnum LIKE '0203001%'
    的写法.
    select * from student where copy(studentnum,1,7)='0203001'
    也行,不过要加'',因为是字符型.
      

  5.   

    select * from student where substr(studentnub,1,7)='0203001';
      

  6.   

    同意  cangwu_lee(小橙子) ( ) 的。