这是同一个表TB里的
第一个查询
select * from TB where a > "XXX"
第二个查询
select * from TB where b > "YYY"
除了select * from TB where a> "XXX" and b>"YYY" 还有什么方法取上面两个查询的交集?
我想实现参数化的查询
但不会写SQL

解决方案 »

  1.   

    select * from TB where a > "XXX" 
    intersect
    select * from TB where b > "YYY" 
      

  2.   

    2楼的方法OK!参照文章如下:
    http://www.oklinux.cn/html/sql/oracle/20070325/12304.html
      

  3.   

    不知道你交集是什么意思?select * from TB where a > 'XXX' or b > 'YYY' 
      

  4.   

    范围?string sql="select * from A where 固定字段='xxx'";if 条件一:  
    sql+="and xxxxxx";if 条件二:
    sql+="and yyyyyy";……