Search Postgresql Archives

How to write a crosstab which returns empty row results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi. New subscriber and intermediate level SQL writer here, still pretty new to Postgresql (but I don't know how to do the following in TSQL either).

I've figured out how to write a crosstab query I need; the problem is that the number of row results should be 72, but I'm only getting 41.  I'm pretty sure this is because there actually isn't any data matching my where constraints for the 31 missing row header values, but I nevertheless need them in my result, with NULLs where there is no data.  How do I force "empty rows" to be included in my query output? (I've tried LEFT JOINing to the row header results, and using CASE statements; but due to my unfamiliarity w/ using crosstab, I'm not sure if I've used those correctly in the current context; so if using either or both of those is part of the solution, please do more than simply saying "use a Left join" or "use a case statement," i.e., furnish an example, please.

Thanks!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux