Repeat each value n times as rows in SQL

前端 未结 4 1611
盖世英雄少女心
盖世英雄少女心 2021-01-28 05:36

I have been trying to achieve this in SQL (Oracle 11g) for a while but could not find a proper way to do it.

My table names has the following rows:

4条回答
  •  别那么骄傲
    2021-01-28 05:59

    If we presume that your all_objects system object has more objects than the max repeat...

    SELECT n.name
    FROM names n
    LEFT JOIN (Select rownum from all_objects) z
     on z.rowNum < n.repeat
    

提交回复
热议问题