Dear all,I tried to retrieve information from two tables.Here is the structure of my first table:
Table Accountsid as integername as stringetc.
And the second one:
Table emailsid as integeraccount as integerread as boolean
So this is very easy: my first table contains the email accounts and the second one, the emails as such. What I would like to retrieve is all the accounts and, for each of them, the number of unread emails. I think I am not so far away from the solution with such query:
SELECT *,count(*) as nb FROM (SELECT * FROM accounts JOIN (SELECT account, read FROM emails WHERE read=False) as emails ON accounts.id=emails.account) as accounts GROUP BY accounts.account
Problem with this query: it only retrieves the accounts which have unread emails. So how to retrieve also the accounts which all emails are read with the number of unread messages set to 0?Thank you very much for your supportBest regards