hello
i want to use ORDER BY heading in a different order than ASC or DESC.
for example i want to order by tv,magazine, webcasts,adverts.
how do i specify this?
If there is a column named tv, you would have as part of the statement: ORDER BY tv
i dont want to order by column name but rather the content inside the column so far example i have a column name "name" and the rows with column contain "tv,webcasts,magazines" etc. obviously inside the column "name"
does it make sense now?
Then what you want is the GROUP BY clause. GROUP BY will take all the items of a certain field, and group them together, then sort them as defined in the ORDER BY clause.
Group By Manual
What you need is to order by case:
ORDER BY CASE name WHEN 'tv' THEN 1 WHEN 'magazine' THEN 2 WHEN 'webcasts' THEN 3 WHEN 'adverts' THEN 4 ELSE 9999 END
thanks the ORDER BY CASE worked. thanks everyone for all the help!