query from 2 tables using count() or a better method
Posted on 2005-03-28
this is my query to the database,
("select a.*, count(b.clientId) AS myCount FROM clients a, cards b WHERE a.storeId=" .$_SESSION['storeId']. " AND a.clientId=b.clientId GROUP BY a.clientId")
it works but if there are no cards from the cards table that match the clientId because of my where statement the client doesnt appear in the client list...
my goal is to have in a table: [clientId - clientName - clientCompany - numberOfCards(count() from another table)]
do you know what I could do to show all the clients even though they have 0 as numbewr of cards