sqlpostgresqlstring-constant

Getting column does not exist error in postgresql sql table


I have an sql table that looks like this in postgresql called test.

    date    |  data   |      source      
------------+---------+------------------
 2015-09-23 | 128     | aaamt
 2015-09-24 | 0       | aaamtx2
.....

I type SELECT * FROM test where source="aaamt" but I get the following error,

ERROR:  column "aaamt" does not exist
LINE 1: SELECT * FROM test where source = "aaamt";

Why am I getting this error and how to I fix it?


Solution

  • You need to use single quote instead of double quote

    SELECT * FROM test where source = 'aaamt'