Timeline for Attempting to Pivot a column of grades and coming up with NULL values
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 2, 2014 at 22:34 | answer | added | Pieter Geerkens | timeline score: 1 | |
Oct 2, 2014 at 16:54 | comment | added | ypercubeᵀᴹ |
I guess you mean the NUMERIC datatype. "Numeric types" in general refers to integer datatypes as well (int, bigint, numeric, decimal, float, etc.)
|
|
Oct 2, 2014 at 16:17 | comment | added | James Durkee | The data type needed to be int, not numeric for the pivot to work. | |
Sep 23, 2014 at 21:01 | comment | added | James Durkee | Got it figured out. It had to do with the type of data for the column. Thanks! | |
Sep 23, 2014 at 20:39 | comment | added | Aaron Bertrand |
Is Grade nullable? If so, does this return any rows: SELECT * FROM csnName WHERE Grade IS NULL AND Catalog IN (198,281,...); ? Also, please clarify what "all values" means - every single column, or just those coming from the pivot?
|
|
Sep 23, 2014 at 20:34 | comment | added | Taryn | You'll get null if the catalog doesn't exist in the subquery - but your query works -- see this demo -- sqlfiddle.com/#!3/2ea0a/2 If this still isn't right, then you'll need to edit your post with some more sample data, and then explain why your query isn't correct. | |
Sep 23, 2014 at 20:31 | comment | added | James Durkee | Yes those are all the catalog numbers. | |
Sep 23, 2014 at 20:10 | history | edited | Paul White♦ |
edited tags
|
|
Sep 23, 2014 at 20:09 | comment | added | Taryn |
Are the values being returned in your subquery for Catalog the same values being used as the new column names here -- FOR [Catalog] IN ([198], [281], [280], [295], [296], [297]) ?
|
|
Sep 23, 2014 at 20:05 | review | First posts | |||
Sep 23, 2014 at 20:11 | |||||
Sep 23, 2014 at 20:04 | history | asked | James Durkee | CC BY-SA 3.0 |