Re: How to write a crosstab which returns empty row results

2022-12-24 Thread David Goldsmith
Here you go: SELECT * FROM crosstab( 'SELECT s.s_n AS Pop , ad.a_d_y::text AS Yr , ad.s_a_qty::text --for some Pop all of these are null for every Yr FROM st AS s

Re: How to write a crosstab which returns empty row results

2022-12-24 Thread Brad White
On 12/24/2022 9:03 PM, David Goldsmith wrote: 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 con

How to write a crosstab which returns empty row results

2022-12-24 Thread David Goldsmith
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 pret