From: | marwis1978 <marwis1978(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Problem with SELECT |
Date: | 2007-10-08 10:28:04 |
Message-ID: | 1191839284.399984.156680@57g2000hsv.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a following table
-----+--------
day | quantity
-----+--------
where day is a date and quantity is an integer value. Now I need to
make a SELECT statement on this table which returns me a full
information on a whole month, it means day>='2007-10-01' and day
<'2007-11-01' but if there is no any quantity for some days a need to
have 0 as a result. Assume that I have following records:
INSERT INTO tmp_table(day, quantity) VALUES('2007-10-01', 23);
INSERT INTO tmp_table(day, quantity) VALUES('2007-10-04', 23);
INSERT INTO tmp_table(day, quantity) VALUES('2007-10-09', 23);
How can I make a SELECT statement to receive:
-----------------+--------
day | quantity
-----------------+--------
2007-10-01 | 23
2007-10-02 | 0
2007-10-03 | 0
2007-10-04 | 23
and so on...?
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2007-10-08 12:27:03 | Re: Very asynchrnous replication system |
Previous Message | Gelembjuk | 2007-10-08 08:41:29 | Install dblink on postgres server on windows |