sqlite 根据列条件创建新行
sqlite creating new rows based on column conditions
我收到这样的数据库:
Product Condition1 Condition2 Condition 3
Computer 1 2
Car 1 2 3
他们希望我以这种形式导出数据库:
Product Condition
Computer 1
Computer 2
Car 1
Car 2
Car 3
这是很多数据,手动修复这些东西没有任何意义。您知道我将如何为此获得动态解决方案吗?非常感谢您的帮助。
这应该有效:
SELECT product, condition1 FROM table_name
UNION SELECT product, condition2 FROM table_name
UNION SELECT product, condition3 FROM table_name
UNION ORDER BY product
我收到这样的数据库:
Product Condition1 Condition2 Condition 3
Computer 1 2
Car 1 2 3
他们希望我以这种形式导出数据库:
Product Condition
Computer 1
Computer 2
Car 1
Car 2
Car 3
这是很多数据,手动修复这些东西没有任何意义。您知道我将如何为此获得动态解决方案吗?非常感谢您的帮助。
这应该有效:
SELECT product, condition1 FROM table_name
UNION SELECT product, condition2 FROM table_name
UNION SELECT product, condition3 FROM table_name
UNION ORDER BY product