我想在数据库中查询  编号  日期  班次   分别和文本框中内容相同的记录
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('select * from 记录 where 编号='+''''+a1.Text+'''');
adoquery2.Open;
这是单条件的
多条件如何写呀

解决方案 »

  1.   

    select * from table where xx=yy or (xxx=yyy and nn=dd) or ....
      

  2.   

    adoquery2.SQL.Add('select * from 记录 where 编号='+ '''+a1.Text+''' +'and 编号1='+ '''+a2.Text+'''');
    有多少都可以往后面加啊
      

  3.   

    在sql语句的条件与句中,逻辑表达式是依然有效的,比如
    and:两者都满足才查询。
        select * from tablename where fieldname1=value1 and fieldname2=value2
    or:两者满足其一就查询。
        select * from tablename where fieldname1=value1 or fieldname2=value2
    not:条件之外的都查询。
        select * from tablename where not(fieldname1=value1)
    同编程语言一样,三者还可以组合查询。