Hi,
If I have user created content in one table, BirdSpecies:
ID BirdName
1 Hawk
2 Sparrow
3 Duck
4 Goose
5 LBJ
and I have collected data in another table BirdData:
ID LocationID BirdID Numbirds
1 2 3 1
2 3 2 5
3 2 1 2
4 7 4 1
5 9 4 4
6 11 3 5
7 5 5 10
I want to generate a view for the totals as follows:
Hawk Sparrow Duck Goose LBJ
2 5 6 5 10
I need to use the BirdName data to create the column names in the view because I want to use this view data in subsequent queries. Ordinarily, I would use SELECT ... AS ..., but the column names are dynamic so I cannot hard code this in this example.
Is there a native SQL statement that will allow this output or does it have to be done elsewhere in a loop?
Thanks in advance.
Regards
Mark