I am collecting soil temperatures at different depths. Different crops have different temperature depths.
My data structure looks like this for each record for each location and depth. The data is the same for each day for this example.
ObsDate:
Location: (field location)
Depth: (for this crop I am measuring at 4", 12" 24" 36")
Temperature:
table picture showing only 1 location
What I am trying to do is have one row of data for each date and location with a column for each depth. When I added the GROUP BY line I only get Temp4 column and not the others.
Thank you for any help.
My data structure looks like this for each record for each location and depth. The data is the same for each day for this example.
ObsDate:
Location: (field location)
Depth: (for this crop I am measuring at 4", 12" 24" 36")
Temperature:
Code:
SELECT
ObsDate,
Location,
CASE WHEN Depth = 4 THEN Temperature END Temp4,
CASE WHEN Depth = 12 THEN Temperature END Temp12,
CASE WHEN Depth = 24 THEN Temperature END Temp24,
CASE WHEN Depth = 36 THEN Temperature END Temp36
FROM `temperature`
GROUP BY ObsDate, Location
table picture showing only 1 location
What I am trying to do is have one row of data for each date and location with a column for each depth. When I added the GROUP BY line I only get Temp4 column and not the others.
Thank you for any help.