Please help with query to show duplicate addresses... TIA!

2004-09-30 Thread Paul Fine
I am trying to come up with a query that shows duplicate last names and the order numbers for each occurance of. I can get as far as determining the duplicates but my query result only outputs one order for each. Here is my current query, an example of the results and an example of the results I

Re: Please help with query to show duplicate addresses... TIA!

2004-09-30 Thread SGreen
Please post the structure of your orders table. (SHOW CREATE TABLE orders). I need to know what you are using as a primary key in order to help you to uniquely identify each duplicated row. Shawn Green Database Administrator Unimin Corporation - Spruce Pine Paul Fine [EMAIL PROTECTED] wrote

Re: Please help with query to show duplicate addresses... TIA!

2004-09-30 Thread Brent Baisley
If you are using 4.1, you can look into the GROUP_CONCAT function. Otherwise, try a self join like this: SELECT A.LastName,A.OrderNum,B.OrderNum FROM Orders AS A LEFT JOIN Orders AS B ON A.LastName=B.LastName WHERE A.OrderNum!=B.OrderNum ORDER BY A.LastName That joins the Order table with itself

Re: Please help with query to show duplicate addresses... TIA!

2004-09-30 Thread Michael Stassen
Brent Baisley wrote: If you are using 4.1, you can look into the GROUP_CONCAT function. Otherwise, try a self join like this: SELECT A.LastName,A.OrderNum,B.OrderNum FROM Orders AS A LEFT JOIN Orders AS B ON A.LastName=B.LastName WHERE A.OrderNum!=B.OrderNum ORDER BY A.LastName That joins the