select *
from relative_info a
where a.rowid > (
select min(b.rowid) from relative_info b
where a.num = b.num and a.name_R = b.name_R)
from relative_info a
where a.rowid > (
select min(b.rowid) from relative_info b
where a.num = b.num and a.name_R = b.name_R)
from person_info where num_R in
(select num_R from relative_info
where num in (select num from person_info)
group by Name_R
having count(Name_R) >=2 )
select a.num,a.num_r,a.name_r
from relative_info a,(select count(num_r),num
from relative_info group by num having(count(num_r)>1)) b
where a.num=b.num
where a.rowid >(
select min(b.rowid) from relative_info b
where a.num = b.num and a.name_R = b.name_R)
where (num,Name_R)in
(select num,Name_R from relative_info
group by (num,name_r)
having count(*)>=2) and
num in (select num from person_info)
FROM person_info p,relative_info r1,relative_info r2
WHERE r1.name_r=r2.name_r --内联查询条件
AND NOT r1.num_r=r2.num_r
AND r1.num=p.num
AND r2.num=p.num
问题解决,使用两个人的语句达到一样的效果
可不可以解释一下rowid的用法
...
where a.rowid >(
select min(b.rowid) from relative_info b
...
rowid取出来的最小那条和其他满足条件的记录比较以后
用>符号选择出来。
受教了~
结贴