pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gary Stainburn <gary.stainburn@ringways.co.uk>
To: pgsql-sql@postgresql.org
Subject: Solved - best way: diary functions.
Date: Wed, 4 Apr 2007 14:27:08 +0100
Message-ID: <200704041427.09056.gary.stainburn@ringways.co.uk> (raw)
In-Reply-To: <200704031325.50542.gary.stainburn@ringways.co.uk>
References: <200704031325.50542.gary.stainburn@ringways.co.uk>

My solution that works is:

select date_range as rdate, 
  case 
      when rsgsid is not null then 2
      when aid is not null then 1
      else 0
  end as status
  from date_range('2007-04-01','2007-04-30')
  left join availability a on a.asid = 1 and (date_range,date_range) overlaps 
(a.asdate,a.afdate)
  left join roster_staff r on r.rsdate = date_range;

Can anyone see any problems or improvements to this?
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     



Message-ID: <200704041427.09056.gary.stainburn@ringways.co.uk>
Permalink:  ../200704041427.09056.gary.stainburn@ringways.co.uk/
Also on:    postgresql.org/message-id/200704041427.09056.gary.stainburn@ringways.co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gary.stainburn@ringways.co.uk
  Subject: Re: Solved - best way: diary functions.
  In-Reply-To: <200704041427.09056.gary.stainburn@ringways.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox