如何使用多列名称进行groupBy?

时间:2015-08-22 09:49:36

标签: sql group-by

我有一个名为tags的表。 Column名称为id,tag_name。 我希望group by使用tag_name

这将是这样的,

{ beauty,general-health,pregnency } as health

sql查询是什么?

2 个答案:

答案 0 :(得分:0)

做一个子查询

   select...
    from (
    select { beauty,general-health,pregnency } as health
    from table) t
    group by health

答案 1 :(得分:0)

  select * from tags group by tag_name