To make this article, I have taken Table A and Table B as reference tables for explaining.
SELECT*FROM A id name RowState ----------- ------------------------------ -------- 1 A1 1 2 A2 1 3 A3 0 4 A4 0 5 A5 1 (5 row(s) affected) SELECT*FROM B id name RowState aid