Re: [SQL] pull in most recent record in a view

2012-10-28 Thread David Johnston
On Oct 26, 2012, at 5:24, Gary Stainburn wrote: > This is my best effort so far is below. My concern is that it isn't very > efficient and will slow down as record numbers increase > > create view current_qualifications as > select q.*, (q.qu_qualified+q.qu_renewal)::date as qu_expires from >

Re: [SQL] pull in most recent record in a view

2012-10-28 Thread Gary Stainburn
This is my best effort so far is below. My concern is that it isn't very efficient and will slow down as record numbers increase create view current_qualifications as select q.*, (q.qu_qualified+q.qu_renewal)::date as qu_expires from qualifications q join (select st_id, sk_id, max(qu_qualified

[SQL] pull in most recent record in a view

2012-10-28 Thread Gary Stainburn
I know I've asked a similar question before but I can't find it. I'm doing a new project for a charity which involves managing a skills / requesit matrix. For each skill type / staff id I need to keep a record of when the skill was aquired/renewed and when it expires. Put simply skills=# selec

Re: [SQL] complex query

2012-10-28 Thread Oliveiros d'Azevedo Cristina
Hi, Scott. I'd like to kick in this thread to ask you some advice, as you are experienced in optimizing queries. I also use extensively joins and unions (less than joins though). Anyway, my response times are somewhat behind miliseconds, they are situated on seconds range, and sometimes they ex