Prev: Select a row in a group with a column that has the maximum value
Next: Cannot see SQL Server 2008 on other node!
From: Deep on 13 May 2010 09:16 Dear Friends Please see it I want query Table name emp A B C D vivek vinod randhir Delhi vivek vinod randhir patna vivek vinod randhir Kolkata vivek vinod randhir Madras I want record like Vivek vinod randhir Delhi,patna,Kolkata,Madras
From: --CELKO-- on 13 May 2010 10:30 Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. If you know how, follow ISO-11179 data element naming conventions and formatting rules. Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. Sample data is also a good idea, along with clear specifications. It is very hard to debug code when you do not let us see it. If you want to learn how to ask a question on a Newsgroup, look at: http://www.catb.org/~esr/faqs/smart-questions.html If you don't know anything about RDBMS, then get a copy of the simplest intro book I know -- http://www.amazon.com/Manga-Guide-Databases-Mana-Takahashi /dp/1593271905 Why do you wish to destroy First Normal Form (1NF) with a concatenated list structure? Normal forms are the foundation of RDBMS, after all. Why are you formatting data in the back end? The basic principle of a tiered architecture is that display is done in the front end and never in the back end. This is a more basic programming principle than just SQL and RDBMS. Get a reporting tool so you can do a sort for your lists and lay them out on paper or a screen in a way that a human being can read them.
From: Tom Cooper on 13 May 2010 12:41 Various ways to do this can be found at http://www.projectdmx.com/tsql/rowconcatenate.aspx Tom "Deep" <vinodkus(a)gmail.com> wrote in message news:f0a67a61-28ee-41a8-8f12-e4a36275f9c1(a)y18g2000prn.googlegroups.com... > Dear Friends > > Please see it > I want query > > Table name emp > A B C D > vivek vinod randhir Delhi > vivek vinod randhir patna > vivek vinod randhir Kolkata > vivek vinod randhir Madras > > I want record like > Vivek vinod randhir Delhi,patna,Kolkata,Madras > >
From: Plamen Ratchev on 13 May 2010 12:43 Here are different methods to handle that: http://www.projectdmx.com/tsql/rowconcatenate.aspx -- Plamen Ratchev http://www.SQLStudio.com
From: Tony Rogerson on 15 May 2010 04:30
> Why do you wish to destroy First Normal Form (1NF) with a concatenated > list structure? Normal forms are the foundation of RDBMS, after > all. It is quite clear that the OP is after the set that is {Delhi,patna,Kolkata,Madras}, the composite key for that set are the attributes A, B and C. If normalised we would indeed classify that as a repeating group for sure, however, the OP is clearly after a result and already has the source table in 1NF. Normal Form has nothing what so ever to do with SQL, SQL is simply a poorly written abstraction later across the Relational Model. I believe ISO 2008 has the ability to hold non scalar data types now which is a move in the right direction, I'll check in the week - seeing if I can get it through the university before forking out buying it. --ROGGIE-- "--CELKO--" <jcelko212(a)earthlink.net> wrote in message news:d13c2515-314d-42b3-bb27-7c785c8f121d(a)k29g2000yqh.googlegroups.com... > Please post DDL, so that people do not have to guess what the keys, > constraints, Declarative Referential Integrity, data types, etc. in > your schema are. If you know how, follow ISO-11179 data element naming > conventions and formatting rules. Temporal data should use ISO-8601 > formats. Code should be in Standard SQL as much as possible and not > local dialect. > > Sample data is also a good idea, along with clear specifications. It > is very hard to debug code when you do not let us see it. If you want > to learn how to ask a question on a Newsgroup, look at: > http://www.catb.org/~esr/faqs/smart-questions.html > > If you don't know anything about RDBMS, then get a copy of the > simplest intro book I know -- > http://www.amazon.com/Manga-Guide-Databases-Mana-Takahashi > /dp/1593271905 > > Why do you wish to destroy First Normal Form (1NF) with a concatenated > list structure? Normal forms are the foundation of RDBMS, after > all. > > Why are you formatting data in the back end? The basic principle of a > tiered architecture is that display is done in the front end and never > in the back end. This is a more basic programming principle than just > SQL and RDBMS. > > Get a reporting tool so you can do a sort for your lists and lay them > out on paper or a screen in a way that a human being can read them. |