Saturday, October 10, 2009

Get Customers with more than one address

Here's a simple SQL statement that I've used to help me resolve some of our issues be it customer, vendor or item master files:

Select custnmbr, Count(ADRSCODE) As AddressCount
From RM00102
Group By custnmbr
Having Count(ADRSCODE) > 1

or if you want detail use this

Select *
From RM00102
Inner Join (
Select CUSTNMBR, Count(ADRSCODE) As AddressCount
From RM00102
Group By CUSTNMBR
Having Count(ADRSCODE) > 1
) As A
On RM00102.CUSTNMBR = A.CUSTNMBR

5 comments:

Locus Academy said...

Locus Academy is an exclusive training centre for Microsoft Products. We have huge number of enquiries from Corporate and individuals on Microsoft Dynamics CRM 4.0 (Technical/Functional),Microsoft Dynamics Axapta 2009 (Technical/Functional) & Microsoft Business Intelligence (MSBI). Our class room (100% practical) training will make you industry experts and can challenge any implementation @ any level. Courses are designed to give students the best combination of skills, experience and training to gain employment with IT giants.
We are proud to deliver right-talents in IT industry [ http://academy.locusit.com ]
Our Features:
♦ Hands on Training
♦ Real-time industry experts from MNCs
♦ Case studies and real-world examples
♦ Customizable
♦ Lab exercises
♦ Mock Projects
♦ Interview Preparation
♦ Experts advice

Other Courses Training from Locus Academy
*Asp.Net *C# *VB.Net *SQL Server 2005 *VBA *MSBI(Microsoft Business Intelligence) *Share Point and all other Microsoft products.

emarks said...


Hi,

we offers clients access to the most extensive and most accurate
New York Business Databases
of business and consumer information.

piping design course said...

Nice Blog
"Sanjary Academy provides excellent training for Piping design course. Best Piping Design Training Institute in Hyderabad,
Telangana. We have offer professional Engineering Course like Piping Design Course,QA / QC Course,document Controller
course,pressure Vessel Design Course, Welding Inspector Course, Quality Management Course, #Safety officer course."
Piping Design Course
Piping Design Course in India­
Piping Design Course in Hyderabad
Welding Inspector Course
Quality Management Course
Quality Management Course in india
Safety officer course

ERBrains said...

ERBrains offers Business Intelligence to their clients based on their industry.

Microsoft Dynamics Partner India - ERBrains said...

Contact us for information.

e-Commerce discount types

In the world of retail today every retailer is trying to find ways and be creative to attract online customers. To attract your attention an...