属性
id value 1 asd 2 def 3 efg 4 jij
佣金
id comm 2 20 3 30
我希望结果是
value, comm asd 20 def 30 efg 20 jij 30
第二个表值根据第一个表记录重复。
yx2lnoni1#
如果你只想重复,用 row_number() 和算术:
row_number()
select c.*, a.* from (select a.*, row_number() over (order by id) as seqnum, count(*) over () as cnt from attributes a ) a join (select c.*, row_number() over (order by id) as seqnum from commission c ) c on a.seqnum - 1 = mod(c.seqnum, a.cnt);
1条答案
按热度按时间yx2lnoni1#
如果你只想重复,用
row_number()
和算术: