Hey All
I am working with a database of realtors and their brokerages where a given realtor might have multiple entries (contacts table) as a result of affiliation with multiple offices (accounts) -- ie John Smith is affiliated with RE/MAX Alliance- Downtown, as well as RE/MAX Alliance South, and RE/MAX Alliance West Metro. ... How would one go about querying the table contacts for records with the same values in a field full_name in order to pair those multiple entries down to a single entry related to a single account?
contacts
full_name
select * from contacts where full_name = full_name and id != id DOESN'T SEEM TO WORK?
If I understand you correctly
SELECT * FROM contacts c1 LEFT JOIN contacts c2 USING (full_name) WHERE c1.id !=c2.id
Or, you could do the following query
SELECT full_name FROM contacts GROUP BY full_name HAVING count(*)>1
Most Excellent liquorvicar!
I learn something new every day. The group by, having count(*) option will come in handy in many situations I'm sure.
Many Thanks!