select min(id) as id,rcid,123 as value from tableB group by rcid
id rcid value ........ 1 1 123 4 2 123select min(id) as id,rcid,value from b where value='123' group by rcid,valueselect * from a where a.rcid in (select distinct(rcid) from b where value=123) ---->> select * from a where a.rcid in (select distinct(rcid) from b where value='123') or: select * from a where exists (select 1 from b where b.value='123' and b.rcid =a.rcid )
select min(id) as id,rcid, min(value) from B where value=123 group by rcid
select distinct * from a,b where a.rcid=b.rcid and b.value=123
select min(id) as id,rcid, min(value) value from B where value=123 group by rcid
select * from a where a.rcid in (select distinct(rcid) from b where value=123)---->>由于A中没有RCID所以没有结果
from tableB group by rcid
1 1 123
4 2 123select min(id) as id,rcid,value
from b
where value='123'
group by rcid,valueselect * from a where a.rcid in (select distinct(rcid) from b where value=123)
---->>
select * from a where a.rcid in (select distinct(rcid) from b where value='123')
or:
select * from a
where exists (select 1 from b where b.value='123' and b.rcid =a.rcid )
from B where value=123 group by rcid
from B where value=123 group by rcid