Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在表中有以下格式的数据。
ORDER_ID PRODUCT_ID QUANTITY O1 A1 3
我需要编写 sql 查询将数据划分为以下格式:
ORDER_ID PRODUCT_ID QUANTITY O1 A1 1 O1 A1 1 O1 A1 1
查询应根据数量列中的值拆分数据。
谢谢
请试试:
SELECT ORDER_ID, PRODUCT_ID, 1 QUANTITY from dual LEFT JOIN YourTable T on 1=1 connect by level <= T.Quantity