October 3, 2009 at 11:25 pm
Hi,
I have a typical requirement can some one help me for this.Below is the description
I have a Ticket table like
Sector Blocks Row SeatNumber
------------------------------------------
A - Exclusive229B1
A - Exclusive229B2
A - Exclusive229B3
A - Exclusive229B4
A - Exclusive229B5
A - Exclusive229B6
A - Exclusive229B7
A - Exclusive229C1
A - Exclusive229C2
A - Exclusive229C3
A - Exclusive229C4
A - Exclusive229C5
A - Exclusive229C6
A - Exclusive229C7
A - Exclusive229D1
A - Exclusive229D2
A - Exclusive229D3
A - Exclusive229D4
A - Exclusive229D5
A - Exclusive229D6
as you can see Row B,c is having 7 seats and Row D is having 6 seats
Now my requirement is i need the output as
Sector,Block,Row,Seat1,Seat2,Seat2...........
If any Row is having less seats those columns should be null and one more thing the seats count for each Row is not fixed ........
Please help me ASAP and if you need any clarification please ask me
Thanks in advance.....
/********************************************************
Technology is just a tool,in terms of getting the kids working together and motivating them,the teacher is the most important.
********************************************************/
October 4, 2009 at 8:47 am
Read these article by Jeff Moden and I believe you will find your answer plus a lot more:
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
By Jeff Moden, 2009/10/02 (first published: 2008/08/19)
http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
By Jeff Moden, 2008/12/03
October 4, 2009 at 8:55 am
Hi Thanks for your reply, I have already seen those posts before posting my problem may iam poor in Sql i was not able to find any solution from those articles for my requirement/problem.
can you please tell me how i can use pivots for my requirement thanks.
/********************************************************
Technology is just a tool,in terms of getting the kids working together and motivating them,the teacher is the most important.
********************************************************/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply