将GROUP_CONCAT结果拆分为单独的列

时间:2013-09-22 16:03:08

标签: mysql sql mysqli

此查询:

SELECT
GROUP_CONCAT(
    DISTINCT (CONVERT(SaleYear, CHAR(8)))
    ORDER BY
        SaleYear ASC
) AS SaleYears
FROM
    tblsales
WHERE
    Municipality = 'Oakville';

产生这个结果:

1980,1981,1983,1985,1986,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013

所有值都包含在同一列中。如果我希望每个值都在一个单独的列中,我该怎么办?感谢。

0 个答案:

没有答案