Q:

issue with subquery

Query:
SELECT id, username,
       (SELECT username 
          FROM users 
         WHERE email = '{$email}' 
           AND activate = 0 ) AS inactive
  FROM users
 WHERE email = '{$email}'
   AND password = '{$password}'
   AND activate = 1

The field email is UNIQUE so there is no duplication in emails. 
I want to output the username and the id if the combination email,password,activate=1 exists OR output username as inactive if the combination email,activate=0 exists.
update: this is working
       SELECT id,

            (SELECT username 
               FROM users 
              WHERE email = '{$email}' 
            AND activate = 0
            ) AS inactive,

            (SELECT username 
               FROM users 
              WHERE email = '{$email}' 
            AND activate = 1
            AND password = '{$password}'
            ) AS active

            FROM users
            WHERE email = '{$email}'

A:

Try the following
select id, 
   case activate
      when 0 then 'inactive'
      when 1 then username
   end as username
from users
WHERE email = '{$email}'
   AND (activate = 0 or password = '{$password}')

The case statement is present for selecting between multiple options of a column or expression

