Author |
Topic |
cyberpd
Yak Posting Veteran
60 Posts |
Posted - 2007-07-05 : 07:31:53
|
suppose there is a table with 4 columns and only 1 row. for example T(A1,A2,A3,A4).now i need the data vertically.i mean i need a view of the data with 1 column and 4 rows.I don't know if this is possible.Any suggestions / help is appreciated.thanks and regards. |
|
Dallr
Yak Posting Veteran
87 Posts |
Posted - 2007-07-05 : 07:34:21
|
Not answering your question but commenting on your table structure. It seems to me that you have repeating groups in your table which shouldn't be.Dane |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-05 : 07:34:36
|
Assuming all four columns are of same datatypeSELECT Col1 AS theCol FROM Table1UNION ALLSELECT Col2 FROM Table1UNION ALLSELECT Col3 FROM Table1UNION ALLSELECT Col4 FROM Table1 Peter LarssonHelsingborg, Sweden |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-05 : 07:35:49
|
[code]SELECT A1 AS A FROM T UNION ALLSELECT A2 AS A FROM T UNION ALLSELECT A3 AS A FROM T UNION ALLSELECT A4 AS A FROM T[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-07-05 : 07:36:23
|
 KH[spoiler]Time is always against us[/spoiler] |
 |
|
cyberpd
Yak Posting Veteran
60 Posts |
Posted - 2007-07-05 : 08:18:03
|
thanks all of you for the reply..that's what i want with little modification.i need to add a where clause like the followingSELECT Col1 FROM Table1 WHERE C1=T.C1UNION ALLSELECT Col2 FROM Table1 WHERE C1=T.C1UNION ALLSELECT Col3 FROM Table1 WHERE C1=T.C1UNION ALLSELECT Col4 FROM Table1 WHERE C1=T.C1Now I need to give this T.C1 from same table, and value will go once.thanks and regards |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-05 : 09:15:36
|
Oh man!What is C1? What is T.C1? Please, please post full and utterly complete problem description so we don't have to guess Post sample data and expected output.Peter LarssonHelsingborg, Sweden |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-05 : 10:31:35
|
Where do you want to show data?MadhivananFailing to plan is Planning to fail |
 |
|
cyberpd
Yak Posting Veteran
60 Posts |
Posted - 2007-07-06 : 05:08:37
|
thanks peso , madhivanan for the concern..i think i can solve the problem in another way.i mean using functions and stored procedures..thanks and regards |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-06 : 05:18:31
|
Good luck!Peter LarssonHelsingborg, Sweden |
 |
|
|