Hi,
I have an extract from the Iris dataset with just the species and petal_length
species, petal_length
setosa, 1.4
setosa, 1.4
setosa, 1.3
setosa, 1.5
setosa, 1.4
versicolor, 4.7
versicolor, 4.5
versicolor, 4.9
versicolor, 4
versicolor, 4.6
virginica, 5.1
virginica, 5.9
virginica, 5.6
virginica, 5.8
virginica, 6.6
There are exactly 5 values for each species. How can I pivot this and convert it into the following form with the three species as column headers and the corresponding petal_width as rows. I can write a VBA program to achieve this, but that seems like an a cumbersome solution. Is there an SQL query (either in MS Access or SQL server) to achieve this ?
