根据子标签搜索所有类似的ID(Search for all similar ID's based on subids)
如果其他列值被过滤,我想提取所有重复的ID。
例如:
ID Subid 100 99 100 91 100 12 200 32 200 33 200 34 200 35 300 88 300 87 300 86 400 78 400 74 400 73如果我只想查询子ID 99,它应检查其ID,并显示具有该ID的所有行。 结果应该是
ID Subid 100 99 100 91 100 12感谢您是否可以提供帮助。
关心沙拉
I would like to extract all the duplicate ID's if other column value is filtered.
ex:
ID Subid 100 99 100 91 100 12 200 32 200 33 200 34 200 35 300 88 300 87 300 86 400 78 400 74 400 73If i want to query only for sub id 99, it should check its ID, and all the rows having that ID should display. Here the result should be
ID Subid 100 99 100 91 100 12Appreciate if you could help.
Regards sharath
最满意答案
一个简单的条件可以做到这一点
select * from table1 where ID in (select id from table1 where subid = 99);(或)将上面的子查询转换为self join
select t.* from table1 t join table1 t1 on t.ID = t1.ID where t1.subid = 99;A simple where condition would do this
select * from table1 where ID in (select id from table1 where subid = 99);(OR) convert above subquery to a self join
select t.* from table1 t join table1 t1 on t.ID = t1.ID where t1.subid = 99;更多推荐
发布评论