[GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Arup Rakshit
Here is my try : staging::= select  to_char(created_at,'DD/MM') || '/' || to_char(now(),'') as when from users;     when      24/02/2014  28/02/2014  02/03/2014  01/03/2014  04/03/2014  02/03/2014  06/03/2014  07/05/2014  02/06/2014  06/06/2014  20/02/2014  20/02/2014  

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Michael Paquier
On Wed, Jul 2, 2014 at 3:27 PM, Arup Rakshit arupraks...@rocketmail.com wrote: Here is my try : staging::= select to_char(created_at,'DD/MM') || '/' || to_char(now(),'') as when from users; when 24/02/2014 28/02/2014 02/03/2014 01/03/2014 04/03/2014

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Arup Rakshit
Here is my try : staging::= select  to_char(created_at,'DD/MM') || '/' || to_char(now(),'') as when from users;     when      24/02/2014  28/02/2014  02/03/2014  01/03/2014  04/03/2014  02/03/2014  06/03/2014  07/05/2014  02/06/2014  06/06/2014  20/02/2014  20/02/2014  

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Adrian Klaver
On 07/02/2014 12:48 AM, Arup Rakshit wrote: What is the data at your disposal when trying to select the current year? If it is a timestamp, simply use date_part: =# select date_part('year', now()); date_part --- 2014 (1 row) -- Michael It is *datetime*. Now my users are

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Steve Crawford
On 07/01/2014 11:27 PM, Arup Rakshit wrote: Here is my try : staging::= select to_char(created_at,'DD/MM') || '/' || to_char(now(),'') as when from users; when 24/02/2014 ... 20/02/2014 (15 rows) Can the same be done using any other clever trick ? No tricks are

Re: [GENERAL] How can I replace the year of the created_at column with the current year dynamically ?

2014-07-02 Thread Arup Rakshit
On Wednesday, July 02, 2014 08:42:43 AM Steve Crawford wrote: On 07/01/2014 11:27 PM, Arup Rakshit wrote: Here is my try : staging::= select to_char(created_at,'DD/MM') || '/' || to_char(now(),'') as when from users; when 24/02/2014 ...