Re: Odd SQL error

"Andrzej Miazga" <[email protected]> Tue, 18 Jul 2006 09:59:55 +0200
Newsgroups gmane.comp.db.mckoi
Message-ID <003a01c6aa40$28084fa0$1c01a8c0@NBANDRZEJ>
Hello,

When you replace "order by 1, 2" by "order by 1, str_1", everything works OK.

Greetings,
Andrzej Miazga
  ----- Original Message ----- 
  From: M. A. Sridhar 
  To: Mckoi mailing list 
  Sent: Monday, July 17, 2006 7:20 PM
  Subject: *****SPAM***** Odd SQL error


  Hello,

  Here is a query that produces a strange error:

    select Address.city as atr_0, count(Address.line_1) as atr_1 from Address,Product where Product.address = Address.address_id and Product.inactive = '0' and Product.orgName = 2 group by Address.city order by 1,2

  The error is:
'count' can only be used as an aggregate function.But if I remove the '2' in the order by clause, the problem goes away. This means that Mckoi cannot order by aggregate functions, it seems. I'm rather surprised. Any comments? Fixes/changes?

  Thanks in advance.
  M. A. Sridhar 
  m_a_sridhar at yahoo dot com