将行结果集转换为列SQLite

时间:2016-02-16 10:39:34

标签: javascript sql angularjs sqlite

我在使用SQLite

的查询中有这样的结果集
ID    description   value
1      name          john
2.     age            30
3.     location       kl

我想将结果集转换为像这样的列

name     age      location
john     30        kl 

我该怎么做?

我正在使用SQLite和javascript,angularjs

谢谢

1 个答案:

答案 0 :(得分:0)

您可以使用此查询:

SELECT max(case when description = 'name' then value end) as name,
       max(case when description = 'age' then value end) as age,
       max(case when description = 'location' then value end) as location
FROM YourTable(or query..)