How to find all the days in which there was no Customer Service Requests (CSR’s)

1.  query1=Generate a date series from the beginning of production until today
                     reduced by weekends and holidays

2.  query2= All distinct dates for CSR entries

3. query1 EXCEPT query2
     returns all rows that are in the result of query1 but not in the result of query2
   
select date(no_csr)
from generate_series(‘2011-02-21 00:00’,current_timestamp, ‘1 day’) as no_csr
where extract(dow from no_csr) not in (0,6)
  and date(no_csr) not in (‘2011-01-06′,’2011-04-25′,’2011-06-22′,’2011-06-23’,
                                               ‘2011-08-05’, ‘2011-08-15′,’2011-11-01′,’2011-12-26’,
                                               ‘2012-01-06′,’2012-04-09’, ‘2012-05-01′,’2012-06-07’,
                                               ‘2012-06-22′,’2012-06-25′,’2012-08-15′,’2012-10-08’,
                                               ‘2012-11-01′,’2012-12-25′,’2012-12-26’)
except
select distinct
created_date from csr;

Oglasi
Ovaj unos je objavljen u Nekategorizirano. Bookmarkirajte stalnu vezu.

Komentiraj

Popunite niže tražene podatke ili kliknite na neku od ikona za prijavu:

WordPress.com Logo

Ovaj komentar pišete koristeći vaš WordPress.com račun. Odjava / Izmijeni )

Twitter picture

Ovaj komentar pišete koristeći vaš Twitter račun. Odjava / Izmijeni )

Facebook slika

Ovaj komentar pišete koristeći vaš Facebook račun. Odjava / Izmijeni )

Google+ photo

Ovaj komentar pišete koristeći vaš Google+ račun. Odjava / Izmijeni )

Spajanje na %s