I have a problem with PostgreSQL to_date() function, in my code mentioned bellow I get syntax error but can't find where.
SELECT * from crosstab('select upit, sat, count(*) as broj
from upiti
where datum >= to_date('26-10-2014','DD-MM-YYYY') AND datum <= to_date('29-10-2014','DD-MM-YYYY')
group by upit,sat
ORDER BY upit,sat',
'select rbrSat from sat order by rbrSat') as ct (upit text, s00 INT, s01 INT, s02 INT, s03 INT, s04 INT, s05 INT, s06 INT, s07 INT, s08 INT, s09 INT, s10 INT, s11 INT, s12 INT, s13 INT, s14 INT, s15 INT, s16 INT, s17 INT, s18 INT, s19 INT, s20 INT, s21 INT, s22 INT, s23 INT);
It says that syntax error is near "2014". Anyone knows where is the problem?
to_date()when using dates in YYYY-MM-DD format).'earlier in the query, making the previous string end just before 2014 instead of starting just before it.