THis is a once a year data extract that I need to send out. I am trying to consolidate seat information on a per customer basis if their order consists of seats in the same row. If the seat_row is different then output two records for the customer.
I am willing to use cursor if necessary. Please help!!
create table seating
(
customer_no int not null,
section varchar(30) null,
seat_row char(10) null,
seat_num char(10) null
)
insert seating values (108, 'Orchestra 2', 'N', '8')
insert seating values (108, 'Orchestra 2', 'N', '9')
insert seating values (108, 'Orchestra 2', 'N', '10')
insert seating values (111, 'Gallery Upper', 'S', '1')
insert seating values (111, 'Gallery Upper', 'S', '2')
insert seating values (111, 'Gallery Upper', 'T', '1')
result should look like this:
customer section seat_row seat_num
108 Orchestra 2 N 8,9,10
111 Gallery Upper S 1,2
111 Gallery Upper T 1
I am willing to use cursor if necessary. Please help!!
create table seating
(
customer_no int not null,
section varchar(30) null,
seat_row char(10) null,
seat_num char(10) null
)
insert seating values (108, 'Orchestra 2', 'N', '8')
insert seating values (108, 'Orchestra 2', 'N', '9')
insert seating values (108, 'Orchestra 2', 'N', '10')
insert seating values (111, 'Gallery Upper', 'S', '1')
insert seating values (111, 'Gallery Upper', 'S', '2')
insert seating values (111, 'Gallery Upper', 'T', '1')
result should look like this:
customer section seat_row seat_num
108 Orchestra 2 N 8,9,10
111 Gallery Upper S 1,2
111 Gallery Upper T 1