Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Can SQL data be formatted with data separated by groups?

$
0
0

I have a table of data that contains CustomerIDs and addresses. Each CustomerID can potentially have multiple addresses associated with it. What I am trying to do is create an SQL Query that would show data grouped by CustomerID in the following way

Customer1

AddressID1 Addr1 Addr2 City State Zip

AddressID2 Addr1 Addr2 City State Zip

Customer2

AddressID1 Addr1 Addr2 City State Zip

AddressID2 Addr1 Addr2 City State Zip

Ultimately what I am trying to do is build an Excel file from the data built exactly in that way and then add a column with some new data that is then imported back into the ERP system. I need it formatted in that way because the custom import application requires it. This would be very time consuming to do manually because we have a few thousand customer records.

Can a select query be written that formats the...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>