Problem with SELECT
| От | marwis1978 |
|---|---|
| Тема | Problem with SELECT |
| Дата | |
| Msg-id | 1191839284.399984.156680@57g2000hsv.googlegroups.com обсуждение исходный текст |
| Ответы |
Re: Problem with SELECT
|
| Список | 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...?
В списке pgsql-general по дате отправления: