I'd like to look for a.id
from TableA which is more than 1 b.this_id
is IN a.id_list
.
example table
TableA as a
id name id_list
1 xyz /0/1
2 efd /0/1/2
3 abc /0/2/3
4 pqr /0/2/3/4
TableB as b
this_id
2
3
4
if we count this_id
on tableA,
TableA as a
id number of this_id id_list
1 0 /0/1
2 1 /0/1/2
3 2 /0/2/3
4 3 /0/2/3/4
since id 3,4 have more than 1 this_id
, I'd like to select id 3,4.
but since id_list is string, it's quite tricky for me to do that.
Is there any way to implement it?
*I made this sql but apparently not works.
SELECT a.id
FROM tableA a
WHERE a.id_list IN (select b.this_id from tableB b)
and a.id IN (select b.this_id from tableB b);