Grafana histogram grouping data

Hi All,
I have influxdb data with fields from temp1 to temp150 and corresponding values for each. Now in Grafana, I want to group them into histogram like temp1 to temp30 into 1 group and similarly temp31 to temp60 other group and rest. How can we do this? I am using influxQL.