Wypróbuj ten:
select a.id from Table1 a
inner join Table1 b on a.uid = b.uid and b.dept = 'dept1';
Demo:http://sqlfiddle.com/#!2/05774/4
Wypróbuj ten:
select a.id from Table1 a
inner join Table1 b on a.uid = b.uid and b.dept = 'dept1';
Demo:http://sqlfiddle.com/#!2/05774/4