gpt4 book ai didi

windows - “was unexpected at this time.”

转载 作者:行者123 更新时间:2023-11-29 13:11:57 27 4
gpt4 key购买 nike

我正在尝试运行以下代码,但遇到了“此时意外”错误。

(echo COPY (SELECT ta.colA as name, ta.colB as user_e, ta.colC as user_n, ta.activation_dt, ta.creation_dt, MAX(tb.update_dt) as updated_at, MAX(tb.login_dt) as lastest_login, tc.colD as roleFROM tblA ta, tblB tb, tblC tc WHERE ta.id = tb.tb_id AND ta.tc_id = tc.id AND tc.colD <> 'Guest' GROUP BY ta.colA, ta.colB, ta.colC, ta.activation_dt, ta.creation_dt, tc.colD ORDER BY ta.colA, tc.colD^^^) TO 'E:\Details.csv' CSV DELIMITER ',' HEADER;) | psql -h localhost -p 8060 -U uname -d dbase

请寻找一些见解。谢谢。

Screenshot of error encountered

最佳答案

尝试在 SQL 周围添加一些引号,并去掉括号:

echo "COPY ..." | psql -h localhost -p 8060 -U uname -d dbase

或者使用-c选项:

psql -h localhost -p 8060 -U uname -d dbase -c "COPY ..."

我更喜欢 -c 因为它适用于所有操作系统

关于windows - “was unexpected at this time.”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53644971/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com