我在这部分中遇到错误之前我没有使用分区功能但它现在给我错误我用它替换它 其他查询,我想将行转换为列,也请任何人给出如何创建动态项目列 this is a look of my data
v<-sqldf(
"select id,item1,item2,item3,item4,item5,item6,item7,item8,item9,item10
from(
select a.*,'item' || count(*) row_no
from ddd a join ddd b on a.id = b.id and b.rowid <= a.rowid
group by a.rowid
order by a.rowid
)Temp
pivot
(
max(name)
for row_no in (item1,item2,item3,item4,item5,item6,item7,item8,item9,item10)
)Piv"
)