473,511 Members | 12,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change table format from row to cloumner

232 New Member
i have a table in format
item_id packet_no
1 4
1 5
2 6
3 7
3 8
3 9
4 10
4 11
i want to convert it into this format
item_id packet_1 packet_2 packet_3
1 4 5
2 6
3 7 8 9
4 10 11
is it possible by sql query?
kindly help
thanx
Jul 16 '12 #1
2 1605
ck9663
2,878 Recognized Expert Specialist
Yes.

Checkout the PIVOT clause.

Happy Coding!!!


~~ CK
Jul 16 '12 #2
Rabbit
12,516 Recognized Expert Moderator MVP
If you have 2005 or later, you'll want to use the row_number() function before the pivot. If you have an earlier version, you'll want to use a ranking query before the pivot.
Jul 16 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2416
by: teqnow | last post by:
I created a table with a timestamp field called "date_added", and it defaults to the NOW function. Any way to change the format to get it to default to the current date instead? I really don't want...
236
9753
by: Andrew Rawnsley | last post by:
Anyone out there using beta 2 in production situations? Comments on stability? I am rolling out a project in the next 4 weeks, and really don't want to go though an upgrade soon after its released...
1
2248
by: Woof | last post by:
Hi, I'm populating the nodes of a Tree View control via an SQL database, with the lowest child nodes (leaves from now on) Text field being set to a lengthy set of HTML. The outcome is a...
2
7581
by: sang | last post by:
Hi Pls help to change the Date format in mysql Mysql default storage is yymmdd but i want to store mmddyy. How to change the format. Thanks, Sang
1
1171
by: prasathas | last post by:
i am trying to display my datas in the table format that i am fetching from database... while running the progrom it doesnt shows any error.. but in client side scripting the coding shows error as...
1
1251
by: George Eapen | last post by:
Folks.. just wanted to know which class can be used to change the format of a date . eg..Date is given in dd/mm/yy min:sec format.. i want to trim it to "April 20,1995" format. can any...
3
4569
by: Bface | last post by:
Hi all, Hope everyone had a good holiday. I am having a difficult time changing the date format of a field from Excel. I have never had this problem before. I link the excel spreadsheet to my DB,...
1
9292
by: mahendravishwa | last post by:
Hi, I want to change DateTime format in MySQL Database Table in dd/MM/yyyy format. Its possible so please provide guidance. Thanks
3
5310
by: Limno | last post by:
Hi, Can anyone suggest me, how to change the Date format in SQL. By Default it Creates datatype datetime as '0000-00-00 00:00:00'. But i want to change d format as Month/Date/Year. while Creating...
1
2777
by: raghulvarma | last post by:
I am developing windows application. Now I have got the data in the data set . Now I need that to be displayed in the table format, not in the grid.but in the table format as we get in web...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.