| Author |
Topic |
|
guiz
Starting Member
7 Posts |
Posted - 2011-09-29 : 09:33:52
|
| I have as follows...create table t ([a] varchar(3), [b] varchar(3));insert into t(a, b) values('6', '2');insert into t(a, b) values('5', '3');insert into t(a, b) values('2', '3');create table t2([x] varchar(9));insert into t2(x) select (a || ', ' || b) from t;but I want t2.x sorted as '2, 6' '3, 5''2, 3' instead of '6, 2''5, 3''2, 3'Also the solution may be used for a case like the following:create table t ([a] varchar(3), [b] varchar(3), [c] varchar(3), [d] varchar(3), [e] varchar(3), [f] varchar(3));insert into t(a, b, c, d, e, f) values('6', '2', '9', '7', '11', '1');insert into t(a, b, c, d, e, f) values('5', '3', '2', '15', '10', '4');create table t2([x] varchar(9));insert into t2(x) select (a || ', ' || b) from t;to achieve results as such that t2.x sorted as:'1, 2, 6, 7, 9, 11''2, 3, 4, 5, 10, 15'Please, help. Thank's. |
|
|
namman
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-09-29 : 12:02:16
|
| Are you working on Oracle? |
 |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2011-09-29 : 19:04:41
|
| At the risk of sounding like SellCo...[SOAPBOX] A table is an UNordered collection of entities. Why would you care (or know) what the physical order is? You can impose an order when you select the data out of the table or, better yet, return the unordered data to the application and let it present the data in whatever order it wants.[/SOAPBOX]=======================================Faced with the choice between changing one's mind and proving that there is no need to do so, almost everyone gets busy on the proof. -John Kenneth Galbraith |
 |
|
|
|
|
|