I’ve been in .NET for a while, but am still pretty entry level when it comes to the world of SQL. I need some help constructing what I thought should be a simple query.
I have an associative entity that allows customers in one table to have multiple phone numbers (stored in a separate table). Getting the numbers associated with that particular customer is simple. However, I need a query to only show the customers who share a phone number.
I thought perhaps this could be done using a GROUP BY clause and specifying a HAVING Count(*) > 1 (or something), but it’s not getting me the results I’m looking for…
Need to do this as it is a violation of the business logic we are implementing in our BLL and needs to be addressed.
I would join through to the phone numbers and back again to customer, that way you can display who matches with whom and via which number: