On Tue, Dec 10, 2002 at 04:12:22PM +0500, Tariq Murtaza wrote:
> Thanks for help.....
> here is another solution for that...
> SELECT if (Category = 'others', '999', 0) as priority, ID, Category FROM
> ORDER BY priority, Category
That's right. It has the same problem regarding optimization and it
gives you another column in your result set (which you may or may not
> Fred van Engen wrote:
> >On Tue, Dec 10, 2002 at 03:32:13PM +0500, Tariq Murtaza wrote:
> >>I want to achieve recordset like below (sorting category by Name and
> >>including 'Others' at the end),
> >>I want to do that by single query ;), any idea???
> >>ID Category
> >>6 biochemistry
> >>62 Commerce
> >>95 chemistry
> >>2 Engg
> >>87 Ecommerce
> >>7 math
> >>45 physics
> >>1 Software Engg
> >>5 Others
> >Try something like this:
> >SELECT id, category from mytable order by
> >Only problem is that it won't optimize, so use this on small tables only.
Fred van Engen XB Networks B.V.
email: fred.van.engen@stripped Televisieweg 2
tel: +31 36 5462400 1322 AC Almere
fax: +31 36 5462424 The Netherlands