For Example, I have 2 tables.
Table A has Setting/isActive
Table B has Name/Ages/City
So I want to retrieve records from B only when isActive = 1 for Setting ='GetThis' in Table A
something like
if 'GetThis' = 1 from table A
then get records from table B
CodePudding user response:
Don't know which DBMS you're using, but look into the command IF EXISTS
CodePudding user response:
If it should get all records from table B, you can try this;
Select b.name, b.ages, b.city from table_B b, table_A a where a.isActive = 1 and a.Setting ='GetThis'