[SQL] DateDiff() function

2013-07-10 Thread Huan Ruan
Hi Guys We are migrating to Postgres. In the current system, we use datediff() function to get the difference between two dates, e.g. datediff (month, cast('2013-01-01' as timestamp), cast('2013-02-02' as timestamp) returns 1. I understand that Postgres has Interval data type so I can achieve the

[SQL] Migrate to Postgres - Alias a Keyword?

2013-03-04 Thread Huan Ruan
Hi All We are migrating from Firebird to Postgres. We try to minimise changes required to the application code which has lots of SQLs in it. One of the incompatibilities between these two is the way to limit the number of rows returned by a SELECT query. In Postgres, *SELECT * FROM TestTable LIMI