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

MS-SQL Data Transformation - Combine Multiple Records

$
0
0

I'm working on pulling data from a MS SQL 2012 database for one of our partnering agencies. This database holds ticketing information. Each ticket can have multiple items. Our system stores each item on a ticket as its own record, so the data looks like so:

Ticket A - Item 1
Ticket A - Item 2
Ticket A - Item 3
Ticket B - Item 1
Ticket C - Item 1
Ticket C - Item 2

So on and so forth...

The partnering agency is expecting the data as so:

Ticket A - Item 1 - Item 2 - Item 3
Ticket B - Item 1
Ticket C - Item 1 - Item 2

This is fine, except their import is based on a fixed format so I'd need to add placeholders when a ticket does not have the maximum number of items. How would I accommodate this? Tickets can have a varying number of items, minimum of 1 but maximum 10.

Any ideas oh DBA wzards? Thanks in advance for your time!


Viewing all articles
Browse latest Browse all 4871

Trending Articles



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