473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

multiple columns in one row

hey hi i have table like this
a b c
1 4 7
2 5 8
3 6 9

i need that all data under a,b,c in once column of another name like this
d
1
2
3
4
5
6
7
8
9


is there any possibility to get solution means please please reply to my mail...
Aug 17 '12 #1
5 20478
ariful alam
185 100+
try self union to show the columns in one column
Aug 17 '12 #2
ck9663
2,878 Expert 2GB
Option 1:
Unpivot your data

Option 2
Use UNION ALL

Option 3
1. Concatenate your columns
2. Try doing this...

Happy Coding!!!


~~ CK
Aug 17 '12 #3
nbiswas
149 100+
Declare @t table(a int,b int,c int)
Expand|Select|Wrap|Line Numbers
  1. Insert Into @t select 1,4,7 union all select 2,5,8 union all select 3,6,9
  2.  
  3. select d = a from @t union 
  4. select b from @t union 
  5. select c from @t
~~CK: How will you fit your first (Unpivot) and last Option (Concatenate your columns) in this case? Curious to know about this with working code
Aug 24 '12 #4
ck9663
2,878 Expert 2GB
It might actually the longest way to do it but it will still work...

Here, try running this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. with x 
  3. as
  4. (
  5.    select 1 as a, 4 as b, 7 as c
  6.    union all 
  7.    select 2, 5, 8
  8.    union all
  9.    select 3, 6, 9
  10. select 
  11.    d
  12. from   
  13.  (
  14.    select a, b, c
  15.    from x
  16.  ) p
  17.  UNPIVOT
  18.    (
  19.      d for columnname in (a,b,c)
  20.    ) un 
  21.  
  22.  
The last option will work in similar manner. I can post a sample code if you want, but it could be later :)

Happy Coding!!!


~~ CK
Aug 24 '12 #5
select c1 from #ta union select c2 from #ta union select c3 from #ta
Aug 30 '12 #6

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

Similar topics

6
by: Dennis | last post by:
In CSS3 it looks like we'll have multiple column flowing of text (newspaper style) in which the number of columns can be determined automatically given the available horizontal space....
7
by: Billy Jacobs | last post by:
I am using a datagrid to display some data. I need to create 2 header rows for this grid with columns of varying spans. In html it would be the following. <Table> <tr> <td colspan=8>Official...
0
by: David Londeck | last post by:
I am using Visual Basic 2003 and I have written a notepad like application using the RichTextBox control. I am having trouble trying to emulate Microsoft Words text block copy/paste feature. In...
3
by: Jane | last post by:
Hi, If anyone could help me with this, I greatly appreciate it. I would like to know how I can display data from a db in multiple columns rather than have it displayed in 1 column per recordset....
4
by: Cezar | last post by:
Hi, I need to display the content of an ArrayList on multiple columns, like data1 data2 data3 data4 data5 data6 data7 data8 ---- or data1 data3 data5 data7
2
by: Simon Harris | last post by:
Hi All, I have an app which requires a list of coutries to be displayed, so far I have a datagrid which contains displays the countries Ok, along with flag images, these are also links to my...
3
by: simchajoy2000 | last post by:
Hi, I am trying to use a VB.NET listview object to display information from a datatable. I need to have two columns of information but I don't want the user to be able to select each column...
2
by: scratchadere | last post by:
I am tryin to partition a listbox into multiple columns.Here is the real problem.I am getting data from MS ACCESS database.I want to display it juz like how an email account displays unread messages...
2
by: ray well | last post by:
i need to display 2 columns of data in a list box. how would i set this up IN CODE. say my table is tblNames, and i have 2 fields, FirstName, LastName, and want the data to show up in 2...
3
by: Will | last post by:
Can someone help with code to delete multiple columns from an excel spreadsheet? I know which columns I need to delete. The code below will delete a single column but I'm not sure how to delete...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.