sql 查询问题,很简单但是我不会,会者请进

HDJ2013 2003-10-15 06:27:05
一ibquery1,一ibquery2,两个均已查到数据并打开,查询的表是一样的,如何将两个ibquery查到的结果之间相同的查出来
...全文
92 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
wooden954 2003-10-16
  • 打赏
  • 举报
回复
将你两个查询所用语句的两个条件写出来并到同一个条件中再用另一个IBquery查一下不就得了
EastBuBai 2003-10-16
  • 打赏
  • 举报
回复
最好用sql语言吧
Allanlove 2003-10-16
  • 打赏
  • 举报
回复
select ibquery1 from table1 where ibquery1 =(select ibquery2 from table2 )
yuanyu368 2003-10-16
  • 打赏
  • 举报
回复
连接查询还不够啊,我晕,,只要任何一本数据库书上都有介绍,自己写不是更有成就感!~
IORILI 2003-10-16
  • 打赏
  • 举报
回复
呵呵,7楼不错
lingh110 2003-10-16
  • 打赏
  • 举报
回复
假如interbase有这函数intersect(取交集),执行即可
select * from ibquery1
intersect
select * from ibquery2
hmily1688 2003-10-15
  • 打赏
  • 举报
回复
同意楼上的
angle097113 2003-10-15
  • 打赏
  • 举报
回复
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 连接的条件
hiflower 2003-10-15
  • 打赏
  • 举报
回复
SELECT * FROM table1 JOIN table2 ON table1.ID=table2.ID
KL2 2003-10-15
  • 打赏
  • 举报
回复
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 好当家
liufuyahong 2003-10-15
  • 打赏
  • 举报
回复
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
smallcrocodile 2003-10-15
  • 打赏
  • 举报
回复
连接查讯
dickeybird888 2003-10-15
  • 打赏
  • 举报
回复
给你举个例子把
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
whitetiger8 2003-10-15
  • 打赏
  • 举报
回复
自然连接连接操作
HDJ2013 2003-10-15
  • 打赏
  • 举报
回复
interbase
lingh110 2003-10-15
  • 打赏
  • 举报
回复
请问数据库为何?
HDJ2013 2003-10-15
  • 打赏
  • 举报
回复
哇大哥,有没有搞错,我要是知道怎样用连接查询的话我就不问了告诉的详细一点好不好,要么写出sql 要么举例,拜托
ceocio 2003-10-15
  • 打赏
  • 举报
回复
用连接查询即可

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧