csvsqlクエリ構文エラーが発生しましたか?

csvsqlクエリ構文エラーが発生しましたか?

列の値が「PI Date」のレコードをattributes.csv除いて、すべてのレコードを新しいファイルとして取得したいcsvファイルがあります。attributes_withoutPIDate.csvName

csvsqlこのように命令を出す

csvsql -d ',' -I --query 'select * where Name <> "PI Date" from attributes' attributes.csv > attributes_withoutPIDate.csv

エラー発生

(sqlite3.OperationalError) near "from": syntax error
[SQL: select * where Name <> "PI Date" from attributes]
(Background on this error at: http://sqlalche.me/e/e3q8)

文法エラーがあると思います。誰でも問題を解決する方法を提案できますか?

ベストアンサー1

csvsql -d ',' -I --query 'select * from attributes where Name <> "PI Date"' attributes.csv > attributes_withoutPIDate.csv

私はそれを見つけたと思います:-

条項from TABLE の前に来なければなりません。WHERE

このようにクエリを書き換えるとうまくいくようです。

おすすめ記事