Re: order by numeric value

2010-04-28 Thread Martijn Tonies
> But I'd prefer not to see the extra sorting field. You don't need to select a field in order to be able to order by it. So select chart_of_accounts.accountname as Account, concat('$',format(coalesce(sum(sales_journal_entries.debit),0),2)) as Debit, concat('$',format(coalesce(sum(sales_journ

Re: order by numeric value

2010-04-27 Thread Keith Clark
On Wed, 2010-04-28 at 08:57 +1000, Jesper Wisborg Krogh wrote: > On Wed, 28 Apr 2010 08:53:57 Keith Clark wrote: > > But I'd prefer not to see the extra sorting field. > > You don't need to select a field in order to be able to order by it. > > So > > select chart_of_accounts.accountname as Acco

Re: order by numeric value

2010-04-27 Thread Jesper Wisborg Krogh
On Wed, 28 Apr 2010 08:53:57 Keith Clark wrote: > But I'd prefer not to see the extra sorting field. You don't need to select a field in order to be able to order by it. So select chart_of_accounts.accountname as Account, concat('$',format(coalesce(sum(sales_journal_entries.debit),0),2)) as Debi

RE: order by numeric value

2010-04-27 Thread Keith Clark
---+ > | 1.00 | > +---+ > 1 row in set (0.00 sec) > > > Which in that case, it's better to just select balance without the dollar > sign and order on that column.

RE: order by numeric value

2010-04-27 Thread Gavin Towey
er on that column. Regards, Gavin Towey -Original Message- From: DaWiz [mailto:da...@dawiz.net] Sent: Tuesday, April 27, 2010 3:46 PM To: Keith Clark; mysql@lists.mysql.com Subject: Re: order by numeric value Try order by CAST(Balance as decimal(8,2)) asc; Cast will work in the order b

Re: order by numeric value

2010-04-27 Thread DaWiz
Try order by CAST(Balance as decimal(8,2)) asc; Cast will work in the order by. Glenn Vaughn - Original Message - From: "Keith Clark" To: Sent: Tuesday, April 27, 2010 3:52 PM Subject: order by numeric value I have the following statement: select chart_of_accounts.accountname

Re: order by numeric value

2010-04-27 Thread Keith Clark
On Wed, 2010-04-28 at 00:18 +0200, Carsten Pedersen wrote: > Keith Clark skrev: > > I have the following statement: > > > > select chart_of_accounts.accountname as Account, > > concat('$',format(coalesce(sum(sales_journal_entries.debit),0),2)) as > > Debit, > > concat('$',format(coalesce(sum(sales

Re: order by numeric value

2010-04-27 Thread Carsten Pedersen
Keith Clark skrev: I have the following statement: select chart_of_accounts.accountname as Account, concat('$',format(coalesce(sum(sales_journal_entries.debit),0),2)) as Debit, concat('$',format(coalesce(sum(sales_journal_entries.credit),0),2)) as Credit, concat('$',format(coalesce(sum(sales_jou