I have a requirement where I need to soql contacts from account I wrote an soql which should only return account with contacts. Instead I also get accounts without contacts, why?:
[SELECT id, Name, (SELECT id,lastname,firstname FROM Contacts WHERE lastname LIKE '%b%')
FROM Account
WHERE id IN (Select AccountId from contact WHERE Contact.Id != null)
LIMIT 20]