Re: collecting employees who completed 5 and 10 years in the current month

From: Arup Rakshit <aruprakshit(at)rocketmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: collecting employees who completed 5 and 10 years in the current month
Date: 2014-06-30 15:32:33
Message-ID: 4877750.gPAFf06JjZ@linux-wzza.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, June 30, 2014 04:52:32 PM you wrote:
> Hi Arup,
>
> Two ways come to mind for me. They're pretty much the same as Szymon's,
> just minus the sample table creation. I would suggest creating a view
> instead, so you can just select from it whenever you please.
>
>
> create view vw_employee as
> select * from employees
> where ((age(joining_date::date) like '5 years%') or
> (age(joining_date::date) like '10 years%') )
>

But I am using Ruby on Rails framework to develop web application. Here I use
basically query. If no way, then I go for view. It seems I can use this as a
select query. But view of course a good idea.In our web app, we will show this
data as a report. A user can run it whenever he/she feel. All query seems like
current day query. But I really need current month. Again it sometimes feel
like ok, sometimes not. :-)

--
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore,
if you write the code as cleverly as possible, you are, by definition, not
smart enough to debug it.

--Brian Kernighan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rebecca Clarke 2014-06-30 15:52:32 Re: collecting employees who completed 5 and 10 years in the current month
Previous Message Thomas Kellerer 2014-06-30 14:46:49 Re: Examples of projects that use Postgres "as API server"