Results 1 to 9 of 9
Thread: Order by issue, convoluted
Dec 7, 2009, 16:28 #1
- Join Date
- Sep 2008
- 0 Post(s)
- 0 Thread(s)
Order by issue, convoluted
Below is a complete section of my query. I am trying to order by t.age_group but the values don't lend themselves to being ordered the way I want it to be ordered.
The values can begin with O, R or U and I need to order them like this:
R, O, U,
Should I make a new table column for an ordering value, which can be assigned when the record is created or, can this query be amended to do what I need, with the existing data?
LEFT OUTER JOIN ( SELECT live_product_id , GROUP_CONCAT( CONCAT_WS(',' , t.age_group , t.tariff , t.tariff_terms_abbr , t.currency , tt.tariff_terms ) ORDER BY t.age_group SEPARATOR ';' ) AS tariffs FROM tariffs as t inner join tariff_terms as tt on t.tariff_terms_abbr = tt.tariff_terms_abbr GROUP BY live_product_id ) AS tb