有一个条件查询,combobox1是>,<,>=,<= ;combobx2是数1,2,3,4,5,6,7 我想查出某个学号记录数>=3的记录
我是这么写的,但不对,请大家帮忙改一下。
sql:='select studentnum,studentname,count(*) as num from result  group by studentnum having count(*)';
sql:=sql+combobox1.text;
sql:=sql+combobx2.text;
但是这样写的话,类型不匹配,count(*)后面应该是数值型。应该怎样写呢?

解决方案 »

  1.   

    sql:='select studentnum,studentname,count(*) as num from result  group by studentnum having count(*)';
    sql:=sql+trim(combobox1.text);
    sql:=sql+trim(combobx2.text);试试
      

  2.   

    sql:='select studentnum,studentname,count(*) as num from result group by studentnum, studentname having count(*)';
    sql:=sql+trim(combobox1.text);
    sql:=sql+trim(combobx2.text);
      

  3.   

    'select studentnum,studentname,count(*) as num from result  group by studentnum having count(*)  '''+trim(combobox1.text)+''' '''+trim(combobox1.text)+'''  '
    sql属性写成这样就行了,注意引号