# Database Discussions > Microsoft SQL Server 2008 >  MS SQL 2012 Script Problem

## Theosdoren

I am a studend at a local city college and I am working on a problem which no one even the teacher seams to have know how solve. 

I have 2 Tables. One called "Address" with address information and PK of AddressID. The second Table is "Customer" with customer information and PK of CustomerID and FK of CustomerAddressID. All customer personal information is in the "Customer" Table and all address information is in the "Address" Table.

Problem: Construct and execute a SQL query to count the number of customers in each state. The list should be ordered by the number of customers in descending order, then by state in ascending order.

How do I construct a query script to accomplish this? 

Thank You,
TL

----------


## rmiao

Each customer has multiple addresses or each address is shared by multiple customers? No reason to separate them if none of those are true.

----------

