Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id D6B009FB642; Thu, 5 Jul 2007 16:01:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 86688-05; Thu, 5 Jul 2007 16:01:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sr06-09.mta.terra.com.br (sr06-09.mta.terra.com.br [200.154.152.78]) by postgresql.org (Postfix) with ESMTP id 603DC9FBABC; Thu, 5 Jul 2007 16:01:13 -0300 (ADT) Received: from beleterro.terra.com.br (beleterro.terra.com.br [200.176.10.20]) by burta.hst.terra.com.br (Postfix) with ESMTP id 8E0902FDC0A9; Thu, 5 Jul 2007 16:01:10 -0300 (BRT) X-Terra-Karma: -2% X-Terra-Hash: b61582d22692f819ef2aec037f2f98e0 Received-SPF: pass (beleterro.terra.com.br: domain of terra.com.br designates 200.176.10.20 as permitted sender) client-ip=200.176.10.20; envelope-from=ranieri.oliveira@terra.com.br; helo=[172.16.2.72]; Received: from [172.16.2.72] (200-162-219-207.corp.ajato.com.br [200.162.219.207]) (authenticated user ranieri.oliveira) by beleterro.terra.com.br (Postfix) with ESMTP id 5B85E2F00C2; Thu, 5 Jul 2007 16:01:07 -0300 (BRT) Message-ID: <468D3FD8.7070807@terra.com.br> Date: Thu, 05 Jul 2007 16:00:40 -0300 From: Ranieri Mazili User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: pgsql-general@postgresql.org, pgsql-sql@postgresql.org Subject: Working with dates Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.785 tagged_above=0 required=5 tests=AWL=-0.124, BAYES_50=0.001, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708 X-Spam-Level: * X-Archive-Number: 200707/214 X-Sequence-Number: 116815 Hello, I need to do the following select: Number of days of month - weekends - holydays So this query will return the number of days that people can work Look that I have the holydays in one table, it's bellow: CREATE TABLE holidays ( id_holidays serial NOT NULL, dt_holiday date, holiday_description character varying(60), input_date timestamp without time zone NOT NULL, CONSTRAINT holidays_pkey PRIMARY KEY (id_holidays) ) I have no idea of how do it If someone could help, I would appreciate. Thanks