pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedQuery Related to Check Individual Values of Range!!!
2+ messages / 2 participants
[nested] [flat]
* Query Related to Check Individual Values of Range!!!
@ 2006-05-26 14:05 Jay Kumar Yadav <jaykumaryadav1980@rediffmail.com>
2006-05-26 16:07 ` Re: Query Related to Check Individual Values of Range!!! Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 2+ messages in thread
From: Jay Kumar Yadav @ 2006-05-26 14:05 UTC (permalink / raw)
To: pgsql-jdbc
Dear Friends/Sirs/Madams;
I would like to know about the query or function 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.
Any Idea/Suggetion/Comment would be appriciated and welcome.
Let me clear the Scenario;
In short;
Using Required Field table is as follows;
Table 'DIMENSIONS'
CREATE TABLE DIMENSIONS (
SNO SERIAL PRIMARY KEY,
ID NUMERIC,
YEAR NUMERIC);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (1,2005);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (1,2006);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (1,2007);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (2,2004);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (2,2005);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (2,2006);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (3,2005);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (3,2006);
INSERT INTO DIMENSIONS (ID, YEAR) VALUES (3,2007);
SELECT * from DIMENSIONS;
As follows :
SNO | ID | YEAR
----------------
1 | 1 | 2005
2 | 1 | 2006
3 | 1 | 2007
4 | 2 | 2004
5 | 2 | 2005
6 | 2 | 2006
6 | 3 | 2005
7 | 3 | 2006
8 | 3 | 2007
-----------------
I require the Query to Retrieve the 'ID' which Possess year between 2004 and 2006!
So for ID must have each year 2004, 2005, 2006.
If 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=2 should retrieve.
SELECT ID FROM DIMENSIONS GROUP BY ID,YEAR HAVING YEAR BETWEEN 2004 and 2006;
It returns all 1,2,3 IDs.
I need ID having all values of 2004-2006 ( 2004,2005,2006) should be return means ID=2 here.
So for Front End can be used but i am trying to Utilize the DB if possible.
Thanks in Advance!!
Best Regard and Wishes.
- Jay kumar yadav.
9893123415.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Query Related to Check Individual Values of Range!!!
2006-05-26 14:05 Query Related to Check Individual Values of Range!!! Jay Kumar Yadav <jaykumaryadav1980@rediffmail.com>
@ 2006-05-26 16:07 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2006-05-26 16:07 UTC (permalink / raw)
To: Jay Kumar Yadav <jaykumaryadav1980@rediffmail.com>; +Cc: pgsql-jdbc
On Fri, 26 May 2006, Jay Kumar Yadav wrote:
> I would like to know about the query or function 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.
This question is not appropriate for this list as it has nothing to do
with java or jdbc. I would suggest trying pgsql-sql or pgsql-general.
Kris Jurka
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-05-26 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-26 14:05 Query Related to Check Individual Values of Range!!! Jay Kumar Yadav <jaykumaryadav1980@rediffmail.com>
2006-05-26 16:07 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox