我想在程式中設定一個同時滿足廠商和料號的查詢功能,也就是多條件查詢,這樣的語句要怎樣寫。

解决方案 »

  1.   

    select * from table where a = '厂商' and b = '料号'
      

  2.   

    但从你的描述看不出多复杂,详细一点吧,给个参考select * from 表名 a where 料号=‘’ and exists(
    select 1 from 表名 b where a.id=b.id)
      

  3.   

    我有時要用模糊查詢語法是這樣的
    if CheckBox1.checked then
             adodatasetbookquery.Filter:=querystr+' like '+
                                                   quotedstr('%'+temp+'%')
          else
             adodatasetbookquery.Filter:=querystr+' = '+
                                                          quotedstr(temp);
             adodatasetbookquery.Filtered:=true;
             adodatasetbookquery.First;
    這僅只能是單一條件查詢,要同時滿足二個或二個以上的條件要怎樣寫,(其中querystr是數據庫中字段名)