Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
810 views
in Technique[技术] by (71.8m points)

postgresql - SQL query column does not exist error

I'm totally new in this area please tell me how to fix my problem.

when I write this query "SELECT * FROM places" in my database everything is okay. However when I change it to "SELECT * FROM places WHERE eventId=2", I get error. Please look at this image.

enter image description here

as you can see, eventId column is exist. Why my query throws error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You've almost certainly added the column names in a case-sensitive environment. (PgAdmin comes to mind.) Lowercase them in that same environment to avoid the need to quote fields.

Or change your query to:

select * from places where "eventId" = 2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...