Date and filling issues
От | Christopher Crews |
---|---|
Тема | Date and filling issues |
Дата | |
Msg-id | 687096.56737.qm@web52202.mail.re2.yahoo.com обсуждение исходный текст |
Ответы |
Re: Date and filling issues
Re: Date and filling issues Re: Date and filling issues |
Список | pgsql-sql |
Hi All,<br />I'm not quite sure how to phrase this, but essentially my company has me working on some reports and I havesome charts associated with the SQL results. <br /><br />My current query is:<br /><br />select <br /> transaction_dateas date, <br /> sum(sale_amount) as sales<br />from ej_transaction<br /> where transaction_date <br />betweencurrent_date - Interval '1 month' and current_date<br />group by transaction_date <br />order by transaction_dateasc<br /><br />The issue I'm having is that there are some dates where sales of certain items simply don'ttake place. Instead of putting a date entry in the database with a sale amount of 0, there simply is no entry for thatdate. I need to make a query that will fill in the dates not found within the date range and populate them with the salesvalue of 0.<br /><br />A sample of the current results data would be like<br />date sales<br />2008-03-07 100.00<br />2007-03-10 150.00<br />2007-03-18 50.00<br /><br />and what I'm trying todo is fill in the missing dates with sales values of 0.<br /><br />Thanks,<br />-CC<br /><br /><p><hr size="1" />Nevermiss a thing. <a href="http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs"> Make Yahoo your homepage.</a>
В списке pgsql-sql по дате отправления: