一ibquery1,一ibquery2,两个均已查到数据并打开,查询的表是一样的,如何将两个ibquery查到的结果之间相同的查出来

解决方案 »

  1.   

    哇大哥,有没有搞错,我要是知道怎样用连接查询的话我就不问了告诉的详细一点好不好,要么写出sql 要么举例,拜托
      

  2.   

    给你举个例子把
    ibquery1中的查询语句为:
    select id,name,age,address from table1 where address='上海'
    ibquery2中的查询语句为:
    select id,name,age,address from table1 where address='广州'要联合查询出idquery1和idquery2中age相等的如下:
    select a.*,b.* from 
    (select id,name,age,address from table1 where address='上海') a 
     inner join 
    (select id,name,age,address from table1 where address='广州') b 
    on a.age=b.age
      

  3.   

    select a.Field1,a.field2,a.field3 [a.fieldN..] from Table1 a inner join Table2 b
      on a.field1=b.field1
      and a.field2=b.field2
      and a.field3=b.field3
      .
      .
      and a.fieldN=b.fieldN
      

  4.   

    SELECT * FROM ibquery1 INNER JOIN ibquery2 ON
    (连接语句,还有LEFT JOIN, RIGHT JOIN)
    ibquery1.字段名 = ibquery2.字段名
    (匹配项,表1的某个属性值等于表2的某个属性值才显示)
    WHERE 条件(例如ID=1)(可选)table1    ID     name
               1     好当家
               2     于伟刚
               3     大鳄鱼table2    ID     name
               1     好当家
               2     ???
               8     !!!SELECT table1.* from table1 INNER JOIN table2 ON
    table1.ID = table2.ID AND table1.name = table2.name结果
              ID      name
               1      好当家
      

  5.   

    SELECT * FROM table1 JOIN table2 ON table1.ID=table2.ID
      

  6.   

    select a.*,b.* from 
    (select id,name,age,address from table1 where address='上海') a 
     inner join 
    (select id,name,age,address from table1 where address='广州') b 
    on 连接的条件
      

  7.   

    假如interbase有这函数intersect(取交集),执行即可
    select * from ibquery1
    intersect
    select * from ibquery2
      

  8.   

    select ibquery1 from table1 where ibquery1 =(select ibquery2 from table2 )
      

  9.   

    将你两个查询所用语句的两个条件写出来并到同一个条件中再用另一个IBquery查一下不就得了