选择使用Group By以逗号分隔的值

时间:2012-02-25 11:52:25

标签: sql tsql

我想使用Group By选择commaa分隔值。

示例:如果我想列出以逗号分隔的所有美国州和按国家/地区分组的美国。

1 个答案:

答案 0 :(得分:0)

现在开始:由于您没有与我们分享更多详细信息,因此不是使用“GROUP BY”来完成,而是滥用GROUP(这是stackoverflow):

America, Alabama
America, Alaska
America, Arizona
America, Arkansas
America, California
America, Colorado
America, Connecticut
America, Delaware
America, Florida
America, Georgia
America, Hawaii
America, Idaho
America, Illinois
America, Indiana
America, Iowa
America, Kansas
America, Kentucky
America, Louisiana
America, Maine
America, Maryland
America, Massachusetts
America, Michigan
America, Minnesota
America, Mississippi
America, Missouri
America, Montana
America, Nebraska
America, Nevada
America, New Hampshire
America, New Jersey
America, New Mexico
America, New York
America, North Carolina
America, North Dakota
America, Ohio
America, Oklahoma
America, Oregon
America, Pennsylvania
America, Rhode Island
America, South Carolina
America, South Dakota
America, Tennessee
America, Texas
America, Utah
America, Vermont
America, Virginia
America, Washington
America, West Virginia
America, Wisconsin
America, Wyoming