Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages
Started by Vladimir Stefanovic
Wed, 06 Jul 2005 08:06
SQL Problem: ORDER-ing by COUNT(something)
Author: Vladimir Stefanovic
Date: Wed, 06 Jul 2005 08:06
Date: Wed, 06 Jul 2005 08:06
17 lines
1164 bytes
1164 bytes
Hi, How can I ORDER this SQL by 'Cnt', and not by 'Field'? (when I try 'ORDER BY Cnt', I got an error) SELECT Field, COUNT(Field) AS Cnt FROM Table WHERE SomeCondition GROUP BY Field ORDER BY Field Best regards, Vladimir Stefanovic
Re: SQL Problem: ORDER-ing by COUNT(something)
Author: Viatcheslav V. Vassiliev
Date: Wed, 06 Jul 2005 11:28
Date: Wed, 06 Jul 2005 11:28
34 lines
1755 bytes
1755 bytes
... ORDER BY COUNT(Field) In your query - GROUP BY Field ORDER BY COUNT(Field) - count will always be 1. //------------------------------------------ Regards, Vassiliev V. V. http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + ADO.Net http://www.oledbdirect.com - The fastest way to access MS SQL Server, MS Jet (Access) and Interbase (through OLEDB) "Vladimir Stefanovic" <antivari@po.sbb.co.yu> �������/�������� � �������� ���������: news:42cb9104$1@newsgroups.borland.com... > > Hi, > > How can I ORDER this SQL by 'Cnt', and not by 'Field'? > (when I try 'ORDER BY Cnt', I got an error) > > SELECT Field, COUNT(Field) AS Cnt > FROM Table > WHERE SomeCondition > GROUP BY Field > ORDER BY Field > > > > > Best regards, > Vladimir Stefanovic >
Re: SQL Problem: ORDER-ing by COUNT(something)
Author: Vladimir Stefanovic
Date: Wed, 06 Jul 2005 12:29
Date: Wed, 06 Jul 2005 12:29
9 lines
1044 bytes
1044 bytes
> ORDER BY COUNT(Field) I was blind ;) Thanks a lot... -- Best regards, Vladimir Stefanovic
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads