I have a table customer with the following fields
customerID,CustomerName,Address,City,state,zip. I am trying to write a query
to display all these fields only where the zipcode fields are the same.
My query looks somthing like this:
I have a table customer with the following fields
customerID,CustomerName,Address,City,state,zip. I am trying to write a query
to display all these fields only where the zipcode fields are the same. I am trying to select all rows from the table where all zipcodes occur more than once in the table. I am not looking for any specific zipcode.
My query looks somthing like this:
SELECT DISTINCT A.CUSTNMBR,A.CUSTNAME,A.ADRSCODE,A.CNTCPRSN,
(RTRIM(A.ADDRESS1) + ' ' + RTRIM(A.ADDRESS2) + ' ' + RTRIM(A.ADDRESS3)) AS ADDRESS,A.CITY,A.STATE,A.ZIP,COUNT(A.ZIP) AS ZIPCOUNT
FROM customer as a,customer AS B
where A.CUSTNMBR= B.CUSTNMBR AND A.ZIP=?????
The result from the query would look something like
Customer 1
CustomerID,CustomerName,.....,zip1
Customer2
CustomerID,CustomerName,....,zip1
Any help would be much appreciated.
Thank you!
customerID,CustomerName,Address,City,state,zip. I am trying to write a query
to display all these fields only where the zipcode fields are the same.
My query looks somthing like this:
I have a table customer with the following fields
customerID,CustomerName,Address,City,state,zip. I am trying to write a query
to display all these fields only where the zipcode fields are the same. I am trying to select all rows from the table where all zipcodes occur more than once in the table. I am not looking for any specific zipcode.
My query looks somthing like this:
SELECT DISTINCT A.CUSTNMBR,A.CUSTNAME,A.ADRSCODE,A.CNTCPRSN,
(RTRIM(A.ADDRESS1) + ' ' + RTRIM(A.ADDRESS2) + ' ' + RTRIM(A.ADDRESS3)) AS ADDRESS,A.CITY,A.STATE,A.ZIP,COUNT(A.ZIP) AS ZIPCOUNT
FROM customer as a,customer AS B
where A.CUSTNMBR= B.CUSTNMBR AND A.ZIP=?????
The result from the query would look something like
Customer 1
CustomerID,CustomerName,.....,zip1
Customer2
CustomerID,CustomerName,....,zip1
Any help would be much appreciated.
Thank you!