Link to home
Start Free TrialLog in
Avatar of jtrudeau
jtrudeau

asked on

query from 2 tables using count() or a better method

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

Thanks
Jason
ASKER CERTIFIED SOLUTION
Avatar of WKalata
WKalata

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial