bnageshrao
Programmer
Hi
I have two tables one is called lead and another one is called contact. Companyid is the key in both tables. For each lead there can be either one lead or more than one lead. I would like to find out lead with more than one contacts. I did the grouping based on company ids and pulled the contact names. It shows for each companyid either one or more contacts. What criteria I should use to get just company with more than one contacts. Do I have to use Group By and along with other criteria like having etc. I just dont know the syntax. If some one can shed some light into this, I will be gratefull, thanks in advance. My query looks like this
SELECT Lead_Only_Fields.[Company ID], Contacst_Only_Fields.FirstName, Contacst_Only_Fields.LastName
FROM Lead_Only_Fields INNER JOIN Contacst_Only_Fields ON Lead_Only_Fields.[Company ID] = Contacst_Only_Fields.[Company ID]
GROUP BY Lead_Only_Fields.[Company ID], Contacst_Only_Fields.FirstName, Contacst_Only_Fields.LastName
HAVING ((Count([Lead_Only_Fields]![Company ID])>"1"));
I get an error data type mismatch, i might noe have written the right sql.
I have two tables one is called lead and another one is called contact. Companyid is the key in both tables. For each lead there can be either one lead or more than one lead. I would like to find out lead with more than one contacts. I did the grouping based on company ids and pulled the contact names. It shows for each companyid either one or more contacts. What criteria I should use to get just company with more than one contacts. Do I have to use Group By and along with other criteria like having etc. I just dont know the syntax. If some one can shed some light into this, I will be gratefull, thanks in advance. My query looks like this
SELECT Lead_Only_Fields.[Company ID], Contacst_Only_Fields.FirstName, Contacst_Only_Fields.LastName
FROM Lead_Only_Fields INNER JOIN Contacst_Only_Fields ON Lead_Only_Fields.[Company ID] = Contacst_Only_Fields.[Company ID]
GROUP BY Lead_Only_Fields.[Company ID], Contacst_Only_Fields.FirstName, Contacst_Only_Fields.LastName
HAVING ((Count([Lead_Only_Fields]![Company ID])>"1"));
I get an error data type mismatch, i might noe have written the right sql.