Re: [SQL] extract last months data

2000-06-28 Thread Thomas Lockhart
> I just want to extract last months data, but I don't know whether the > month ended with 29,30 or 31 (external program, that uses postgres), select * from t1 where d >= (date_trunc('month', timestamp 'today') - interval '1 month') and d < date_trunc('month', timestamp 'today

Re: [SQL] extract last months data

2000-06-28 Thread Guillaume Perréal
Antti Linno wrote: > Lo. > Today I digged in manuals and other docs, but didn't find any hint, how > to get data from table, where some cols are in date or datetime format, > and the data was about last month, or about special month. > Psql help was unhelpful too. > Here's example: > In table wo

[SQL] extract last months data

2000-06-28 Thread Antti Linno
Lo. Today I digged in manuals and other docs, but didn't find any hint, how to get data from table, where some cols are in date or datetime format, and the data was about last month, or about special month. Psql help was unhelpful too. Here's example: In table workers is data with different date.