为了旋转我的大查询表,我找到了这段代码
SELECT 'SELECT id, ' ||
STRING_AGG(
'MAX(IF(key = "' || key || '", value, NULL)) as `' || key || '`'
)
|| ' FROM `project.dataset.table` GROUP BY id ORDER BY id'
FROM (
SELECT key
FROM `project.dataset.table`
GROUP BY key
ORDER BY key
但即使我应用EXECUTE IMMEDIATE
函数,它也会返回上面代码的字符串。我在那个功能中错过了什么?
谢谢你的帮助