Home > database >  How to show everything in the table only if a value on a column on another table is equal to 1
How to show everything in the table only if a value on a column on another table is equal to 1

Time:11-17

Our users table has a domain and the domain table has a similar column named domain so I am able to join. But in our domain table there is a column suspended indicating whether the domain is suspended. How do I show all of my users on the users table if the domain.suspended on my domain table is 1?

SELECT *
FROM core.users,core.domain
WHERE core.domain.domain = core.users.domain;

CodePudding user response:

select * 
from core.users 
    inner join core.domain on core.domain.domain=core.users.domain 
where core.domain.suspended=1;
  • Related