Table A has column srno and few other columns.
Table B has columns srno and id.
I want to get srno from B for
Your second query will always be slower. That type of dynamic IN clause in MySQL is never a good approach.
My recommendation would be to use the first query, but rewrite it using ANSI joins syntax and select the minimal set of columns you need, rather than doing SELECT *.
This would be a good starting point:
select table_a.*
from A as table_a
inner join B as table_b on table_a.srno=table_b.srno
where table_b.id=7;