试一下吧
select tb1.学号,tb1.姓名,tb2.序号,tb2.科目名称
from tb1,tb2 where tb1.学号=tb2.学号
order by 姓名
select tb1.学号,tb1.姓名,tb2.序号,tb2.科目名称
from tb1,tb2 where tb1.学号=tb2.学号
order by 姓名
解决方案 »
- 请问向adoquery中add带子查询的SQL语句时内存出错是为什么?内详...
- 同样一个事件为什么手动按按钮可以,定时自动触发就不行呢?
- 怎么在delphi中访问SQLServer2000数据库
- 求助,在线等候,怎样消去面板右上角的最小和最大按钮?????
- 数据库读取字段问题,认为自己是大牛的请进,在线等……
- delphi中有没有类似VC中IDC_LIST这样的控件?
- 在Delphi里用API要声明吗?有没有好的API工具?生成的程序能不能小点?怎么动不动就200多k?
- 求助!!!!interbase 5 数据库损坏,应如何修复?或用什么工具修复?谢谢!
- 怎样在编程得到ADO支持的所有数据库 Provider.
- 如何拦截退出WINDOWS NT的消息,不准用户退出WINDOWS NT?
- 关于光驱的编程
- 请问如何固定窗体大小为设计时的大小,而不能用鼠标拖动来改变其大小呢?谢谢
我用别的方法试试
[email protected]
and exists(select 学号,count(*) from tb2 group by 学号 haiving count(*).1>1 where tb2.学号=tb1.学号) 没试过,不知道行不行:)
from tb1,tb2
where (tb1.xh = tb2.xh) and count(tb1.name) > 1
order by tb1.name
xm:姓名;
no:序号;
km:科目;
select
a.xh,a.xm,b.no,b.km
from
tb1 a,tb2 b
where
a.xh=b.xh
and a.xh in
(select xh from (select xh,count(*) as num from tb2 group by xh) as temptable where num>1)这个一定好用的,我试过了!
100分,我好心动!
科目,(Select 序号 From Table1 Where 学号=Table2.学号) As 序号
From Table2
Where 学号 in (Select 学号 From Table2 Group by 学号 Having Count(序号)>1)
select
a.xh,a.xm,b.no,b.km
from
tb1 a,tb2 b
where
a.xh=b.xh
and a.xh in
(select xh from (select xh,count(*)as num from tb2 group by xh having count(*)>1) as temptable)
select
a.xh,a.xm,b.no,b.km
from
tb1 a,tb2 b
where
a.xh=b.xh
and a.xh in
(select xh from (select xh from tb2 group by xh having count(*)>1)as T)
具体的内容是:
Select TB1.学号,TB1.姓名,TB2.序号,TB3.科目名称
From TB1,TB2,
(Select 学号,Count(*) 科目数 From TB1,TB2 Where TB1.学号=Tb2.学号 Group By 学号) TB3
Where TB1.学号=Tb2.学号
And TB1.学号=Tb3.学号
And Tb3.科目数>1
Order By 姓名仅供参考,感谢所有支持我的朋友,来者有分!!!