有个数据库,有一个表单在表单上有个dbgird,请问用什么查询语句能实现同时符合三个条件的记录并在dbgird上显示出来? 我是新手请不要见笑!!!!!

解决方案 »

  1.   

    select * from xx where xxx=xx and ...=... and ***=**
      

  2.   

    我没用过sql请说下具体步骤和详细的过程好吗
      

  3.   

    条件A,条件B,条件C
    表TABLE语句(ABC之间为并且关系) select * from table where A and B and c     
    语句(ABC之间为或者关系) select * from table where A or B or c     
    语句(ABC之间为并且、或者关系) select * from table where A and (B or c)
      

  4.   

    设置adoquery或Tquery的connection|或database也就是连接数据库.
    加一个datasource 
    query1.close;
    query1.sql.clear;
    sql.text:='select * from xx where xxx=xx and ...=... and ***=**';
    query1.open;
      

  5.   

    select * from xx where 条件一 and  条件二  and 条件三
      

  6.   

    例如:
    with query1 do
     begin
      clear;
      sql.add('select * form tablename where zdname1=value1 and zdname2=value2');
      sql.add('and zdname3=value3');
      open;
     end;
      

  7.   

    if query1.RecordCount<1 就说明没有查到
      

  8.   

    if query.IsEmpty=true then
      begin
       ....
      end;