Reputation: 20570
Select
id,
username,
is_null(email) AS has_email,
FROM
users
;
I want to write the above query, but instead of returning the email, I only want it to return whether there is an email. Is there a way to do that?
Upvotes: 0
Views: 269
Reputation: 8590
Try this
Select
id,
username,
email IS NOT NULL AS has_email
FROM
users
;
Edit: changed IS NULL
to IS NOT NULL
Upvotes: 2