开发者

How to get multi row data of one column to one row of one Column

开发者 https://www.devze.com 2022-12-30 17:18 出处:网络
I need to get data in multiple row of one column. For example 开发者_JAVA技巧data from that format

I need to get data in multiple row of one column.

For example 开发者_JAVA技巧data from that format

ID Interest

  1. Sports
  2. Cooking
  3. Movie
  4. Reading

to that format

ID Interest

  1. Sports,Cooking
  2. Movie,Reading

I wonder that we can do that in MS Access sql. If anybody knows that, please help me on that.


Take a look at Allen Browne's approach: Concatenate values from related records

As for the normalization argument, I'm not suggesting you store concatenated values. But if you want to join them together for display purposes (like a report or form), I don't think you're violating the rules of normalization.


This is called de-normalizing data. It may be acceptable for final reporting. Apparently some experts believe it's good for something, as seen here.

(Mind you, kevchadder's question is right on.)


Have you looked into the SQL Pivot operation? Take a look at this link: http://technet.microsoft.com/en-us/library/ms177410.aspx

Just noticed you're using access. Take a look at this article: http://www.blueclaw-db.com/accessquerysql/pivot_query.htm


This is nothing you should do in SQL and it's most likely not possible at all.

Merging the rows in your application code shouldn't be too hard.

0

精彩评论

暂无评论...
验证码 换一张
取 消