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