The idea is to get in the result a new column describing the user “category”. This category could for example be “under18″,”normal”,”over65″ based on user age.
That is, for each user in my table I want to get as result its ID and this description in a column called “category”.
How would you proceed? I need this because the data will later go to a JSON object and to a ExtJS grid for visualization.
At query level this can be done with
CASEexpression:However i would recommend to move this from query level to application level. You already have application logic to construct JSON from the dataset, this would be a more appropriate place to generate category name from age value.