How to get data from two table.
how to get number of record in table_contacts with group name in query.
i have two table.
GroupMaster
ID | GroupName
1 Friend
2 Family
3. Business
table_Contacts
Id | GroupName | Name
1 Friend XXXX
2 Family xxxxx
3 Friend xxxxx
output in Datatable like
ID G roup Total
1 Friend 2
2 Family 1
3. Business 0

Joginder BangerRank #360 · 7K reputationPosted Jan 30, 2015, 10:37 AM EST
my question is how to set the Business total is zero value.
what you think about this query
prince raj66 reputationPosted Feb 4, 2015, 3:36 AM EST
SELECT GroupMaster.GroupName, Count(GroupMaster.GroupName)
AS NumberOfContact
FROM GroupMaster
LEFT JOIN table_Contacts ON GroupMaster.GroupName = table_Contacts.GroupName
GROUP BY GroupMaster.GroupName;
thanks,