I have a query which returns the results i need, will be putting this into a view as i'll need this for a few different things, one of the things i need it for is to group based on a particular field.
the field is called length, it is in kilometres, i want to group records based on the length as follows:
0-5 = group1
5-10 = group 2
10-20 = group 3
20-40 = group 4
>40 = group 5
could i use a case statement within the view to generate a column with the group name based on the ranges above, and then do a query on this view. grouping by that group column to collate the results?
to keep it simple please assume the following table:
id, roadname, city, state, roadlength
where roadlength is the column i want to group on.