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
prince rajPosted Feb 4, 2015, 8:36 AM
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,
Joginder BangerPosted Jan 30, 2015, 3:37 PM
my question is how to set the Business total is zero value.
what you think about this query