yalnızca hafta içi veri seçmek için bir işlev yazma Postgres 8.3 veritabanı üzerinde çalışıyorum. Kullandığım bir sorgu, yalnızca hafta içi eklenen satırları seçmek içindir. Şu anda elimde bunu aşağıdaki örnekte olduğu gibi yapmaktayım, ancak bunu başlangıç ve bitiş tarihlerini belirleyebileceğim ve aşağıdaki gibi mantığa göre hareket edebileceğim bir funciotn'a aktarmak istiyorum. Yani girdi bir başlangıç ve bitiş tarihi ve işlevinin sonucu yalnızca veri kümelerinin hafta içi dahil tüm satırları seçmek için olacak bir işlev nasıl oluşturabilirimPostgreSQL
(Ben her staurday exlude istiyorum ve pazar nerede koşul koşuluyla olduğu gibi)?
create table filter_tbl as
select *
from base_tbl where
(start_Time >= '2012-11-5' and start_Time < '2012-11-10')
or (start_time >= '2012-11-12' and start_time < '2012-11-17')
or (start_time >= '2012-11-19' and start_time < '2012-11-24')
or (start_time >= '2012-11-26' and start_time < '2012-12-01')
or (start_time >= '2012-12-03' and start_time < '2012-12-07')
or (start_time >= '2012-12-10' and start_time < '2012-12-14')
or (start_time >= '2012-12-17' and start_time < '2012-12-21')
or (start_time >= '2012-12-24' and start_time < '2012-12-28')
or (start_time >= '2012-12-31' and start_time < '2013-01-04')
or (start_time >= '2013-01-07' and start_time < '2013-01-11')
or (start_time >= '2013-01-14' and start_time < '2013-01-18')
or (start_time >= '2013-01-21' and start_time < '2013-01-25')
or (start_time >= '2013-01-28' and start_time < '2013-02-02')
or (start_time >= '2013-02-04' and start_time < '2013-02-09')
or (start_time >= '2013-02-11' and start_time < '2013-02-16')
or (start_time >= '2013-02-18' and start_time < '2013-02-23')
or (start_time >= '2013-02-25' and start_time < '2013-03-02')
or (start_time >= '2013-03-04' and start_time < '2013-03-09')
or (start_time >= '2013-03-11' and start_time < '2013-03-16');
Yükseltmeyi gerçekten düşünmelisiniz. 8.3 artık desteklenmiyor. –
'start_Time'ın veri türü nedir? –