X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 29D689FA279 for ; Fri, 26 May 2006 11:14:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 49373-04 for ; Fri, 26 May 2006 11:14:02 -0300 (ADT) X-Greylist: delayed 00:07:18.893458 by SQLgrey- Received: from rediffmail.com (unknown [203.199.83.36]) by postgresql.org (Postfix) with SMTP id C0B1C9F9B01 for ; Fri, 26 May 2006 11:14:01 -0300 (ADT) Received: (qmail 8155 invoked by uid 510); 26 May 2006 14:05:08 -0000 Date: 26 May 2006 14:05:08 -0000 Message-ID: <20060526140508.8154.qmail@webmail64.rediffmail.com> Received: from unknown (203.101.126.221) by rediffmail.com via HTTP; 26 may 2006 14:05:00 -0000 MIME-Version: 1.0 From: "Jay Kumar Yadav" Reply-To: "Jay Kumar Yadav" To: pgsql-jdbc@postgresql.org Subject: Query Related to Check Individual Values of Range!!! Content-type: multipart/alternative; boundary="Next_1148652300---0-203.199.83.36-7876" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/133 X-Sequence-Number: 15261 This is a multipart mime message --Next_1148652300---0-203.199.83.36-7876 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Dear Friends/Sirs/Madams;=0A=0AI would like to know about the query or func= tion that can check each value between a range. By Use of Between if either= value match, row is retrieved, i want to know is it possible to check all = values of Between must be for particular field.=0A=0AAny Idea/Suggetion/Co= mment would be appriciated and welcome.=0A=0ALet me clear the Scenario;=0A= =0AIn short;=0AUsing Required Field table is as follows;=0A=0ATable 'DIMEN= SIONS'=0A=0ACREATE TABLE DIMENSIONS (=0ASNO SERIAL PRIMARY KEY,=0AID NUMER= IC,=0AYEAR NUMERIC);=0A=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (1,2005)= ;=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (1,2006);=0AINSERT INTO DIMENS= IONS (ID, YEAR) VALUES (1,2007);=0A=0AINSERT INTO DIMENSIONS (ID, YEAR) VAL= UES (2,2004);=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (2,2005);=0AINSERT= INTO DIMENSIONS (ID, YEAR) VALUES (2,2006);=0A=0AINSERT INTO DIMENSIONS (I= D, YEAR) VALUES (3,2005);=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (3,200= 6);=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (3,2007);=0A=0ASELECT * from= DIMENSIONS; =0AAs follows : =0A=0ASNO | ID | YEAR=0A----------------=0A 1= | 1 | 2005=0A 2 | 1 | 2006=0A 3 | 1 | 2007=0A 4 | 2 | 2004=0A 5 | = 2 | 2005=0A 6 | 2 | 2006=0A 6 | 3 | 2005=0A 7 | 3 | 2006=0A 8 | 3 = | 2007=0A-----------------=0A=0AI require the Query to Retrieve the 'ID' wh= ich Possess year between 2004 and 2006!=0ASo for ID must have each year 200= 4, 2005, 2006.=0A=0AIf i use query with or without group on ID with Having = or Where 'BETWEEN year 2004 and 2006' then ID 1,2 and 3 are listed but what= i need is ID must have records for all 2004, 2005 and 2006 so Only ID=3D2 = should retrieve.=0A=0ASELECT ID FROM DIMENSIONS GROUP BY ID,YEAR HAVING YE= AR BETWEEN 2004 and 2006;=0A=0AIt returns all 1,2,3 IDs.=0AI need ID having= all values of 2004-2006 ( 2004,2005,2006) should be return means ID=3D2 he= re.=0A=0ASo for Front End can be used but i am trying to Utilize the DB if = possible.=0A=0AThanks in Advance!!=0A=0A=0A=0ABest Regard and Wishes.=0D=0A= - Jay kumar yadav.=0D=0A 9893123415. --Next_1148652300---0-203.199.83.36-7876 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0ADear Friends/Sirs/Madams;
=0A
=0AI would like to know about the= query or function that can check each value between a range. By Use of Bet= ween if either value match, row is retrieved, i want to know is it possible= to check all values of Between  must be for particular field.
=0A<= BR>=0AAny Idea/Suggetion/Comment would be appriciated and welcome.
=0A=0ALet me clear the Scenario;
=0A
=0AIn short;
=0AUsing Required= Field table is as  follows;
=0A
=0ATable 'DIMENSIONS'
=0A=0ACREATE TABLE DIMENSIONS (
=0ASNO SERIAL PRIMARY KEY,
=0AID  = NUMERIC,
=0AYEAR NUMERIC);
=0A
=0AINSERT INTO DIMENSIONS (ID, YEAR= ) VALUES (1,2005);
=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (1,2006);=
=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (1,2007);
=0A
=0AINSE= RT INTO DIMENSIONS (ID, YEAR) VALUES (2,2004);
=0AINSERT INTO DIMENSIONS= (ID, YEAR) VALUES (2,2005);
=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES= (2,2006);
=0A
=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (3,2005);<= BR>=0AINSERT INTO DIMENSIONS (ID, YEAR) VALUES (3,2006);
=0AINSERT INTO = DIMENSIONS (ID, YEAR) VALUES (3,2007);
=0A
=0ASELECT * from DIMENSION= S;
=0AAs follows :
=0A
=0ASNO | ID | YEAR
=0A----------------=
=0A  1 |  1 | 2005
=0A  2 |  1 | 2006
=0A&nbs= p; 3 |  1 | 2007
=0A  4 |  2 | 2004
=0A  5 | = ; 2 | 2005
=0A  6 |  2 | 2006
=0A  6 |  3 | 2005<= BR>=0A  7 |  3 | 2006
=0A  8 |  3 | 2007
=0A-----= ------------
=0A
=0AI require the Query to Retrieve the 'ID' which Po= ssess year between 2004 and 2006!
=0ASo for ID must have each year 2004,= 2005, 2006.
=0A
=0AIf i use query with or without group on ID with H= aving or Where 'BETWEEN year 2004 and 2006' then ID 1,2 and 3 are listed bu= t what i need is ID must have records for all 2004, 2005 and 2006 so Only I= D=3D2  should retrieve.
=0A
=0ASELECT ID FROM DIMENSIONS GROUP B= Y ID,YEAR HAVING YEAR BETWEEN 2004 and 2006;
=0A
=0AIt returns all 1,= 2,3 IDs.
=0AI need ID having all values of 2004-2006 ( 2004,2005,2006) s= hould be return means ID=3D2 here.
=0A
=0ASo for Front End can be use= d but i am trying to Utilize the DB if possible.
=0A
=0AThanks in Adv= ance!!
=0A
=0A=0A

=0A=0A=0ABest Regard and Wishes.=0D
=0A =     -  Jay kumar yadav.=0D
=0A       =  9893123415.

=0A=0A --Next_1148652300---0-203.199.83.36-7876--