views:

105

answers:

2

Hi

I try to select all records of a table (Postgres DB) with the following sql:

SELECT * FORM 'tablename' WHERE 'myTimestampRow' >= now()

There's allways an error message, telling me that there's an 'invalid input syntax for type timestamp with time zone: "myTimestampRow"'.

What's wrong with the above query?

+1  A: 

You have

SELECT * FORM

instead of

SELECT * FROM

but that might be a typo in the question. I think your problem is the quoting of the columns, it should read either

SELECT * FROM table WHERE timestampRow >= now();

(no quotes) or

SELECT * FROM "table" WHERE "timestampRow" >= now();
Vinko Vrsalovic
+2  A: 

Lose the single-quotes:

SELECT * FROM tablename WHERE myTimestampRow >= now()

You can optionally double-quote column- and table-names, but no single-quotes; they will be interpreted as characters/strings.

Adam Bernier