X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 459D1D1E121 for ; Thu, 22 Apr 2004 05:45:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 53485-01 for ; Thu, 22 Apr 2004 05:45:50 -0300 (ADT) Received: from TYO201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.214]) by svr1.postgresql.org (Postfix) with ESMTP id 308BBD1E0F1 for ; Thu, 22 Apr 2004 05:45:47 -0300 (ADT) Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.160] (may be forged)) by TYO201.gate.nec.co.jp (8.11.7/3.7W01080315) with ESMTP id i3M8jQh02715; Thu, 22 Apr 2004 17:45:46 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id i3M8jQA06554; Thu, 22 Apr 2004 17:45:26 +0900 (JST) Received: from fireball.ntsp.nec.co.jp (postfix@[172.28.58.1]) by isgw1.nec.co.jp (8.11.7/3.7W-ISGW-NEC) with ESMTP id i3M8jOA14183; Thu, 22 Apr 2004 17:45:24 +0900 (JST) Received: from the-one (localhost [127.0.0.1]) by fireball.ntsp.nec.co.jp (Postfix) with ESMTP id 81C8629B0E; Thu, 22 Apr 2004 16:45:31 +0800 (HKT) Received: from 172.28.58.4 ([172.28.58.4] helo=galadriel.ntsp.nec.co.jp) by the-one ; 22 Apr 04 08:45:31 -0000 Received: from hq.ntsp.nec.co.jp (frytrix.hq.ntsp.nec.co.jp [172.28.58.129]) by galadriel.ntsp.nec.co.jp (Postfix) with ESMTP id 5B29440209; Thu, 22 Apr 2004 16:44:46 +0800 (PHT) Received: (from smtp@localhost) by hq.ntsp.nec.co.jp (8.9.2/8.9.2) id QAA20440; Thu, 22 Apr 2004 16:45:20 +0800 (HKT) Received: from UNKNOWN(172.28.59.100), claiming to be "Titanium" via SMTP by frytrix, id smtpdAAA0M5JH9; Thu Apr 22 08:45:12 2004 From: "Vincent Ladlad" To: "'Denis P Gohel'" , Subject: Re: staggered query? Date: Thu, 22 Apr 2004 16:44:53 +0800 Message-ID: <000801c42846$166f2120$643b1cac@Titanium> MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal In-Reply-To: <003601c4276f$ecac8980$3332a8c0@DENIS> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/221 X-Sequence-Number: 17596 hey thanks! it worked:) here's how we did it: select sampletime from data where (extract(seconds from sampletime)::int)::text in (14, 17, 19); -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Denis P Gohel Sent: Wednesday, April 21, 2004 3:12 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] staggered query? Hi Try this.. SELECT Col1 , Col2 FROM yourtable WHERE to_number(to_char(col1, 'SS'),'99') / 10 ) in (10,20,30,40,50,00); HTH Denis > ----- Original Message ----- > From: Vincent Ladlad > To: > Sent: Wednesday, April 21, 2004 8:23 AM > Subject: [SQL] staggered query? > > > > hi! im new to SQL, and i need to find a solution > > to this problem: > > > > i have a table with two columns, the first column > > is of type timestamp. > > > > the table contains hundreds of thousands of records. > > i need to get all the entries/records at every 10 seconds interval. > > example, given a table: > > > > hh/mm/ss | data > > --------------- > > 00:00:00 1 > > 00:00:01 2 > > 00:00:02 3 > > 00:00:03 4 > > 00:00:04 5 > > 00:00:05 6 > > 00:00:06 7 > > 00:00:07 8 > > .. > > .. > > > > my query should return: > > 00:00:10 > > 00:00:20 > > 00:00:30 > > (etc) > > > > is this possible? if yes, how do i do it? > > > > thanks! > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.484 / Virus Database: 282 - Release Date: 5/27/2003 > > > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster > > ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.484 / Virus Database: 282 - Release Date: 5/27/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.484 / Virus Database: 282 - Release Date: 5/27/2003