Article View: borland.public.cppbuilder.database.ado
Article #686Re: SQL Problem: ORDER-ing by COUNT(something)
From: 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 >
Technical Details
Message-ID:
<42cbc077@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.utanet.at!reader.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<42cb9104$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,63f511b1d62f5121 X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <42cb9104$1@newsgroups.borland.com> Subject: Re: SQL Problem: ORDER-ing by COUNT(something) Date: Wed, 6 Jul 2005 15:28:53 +0400 Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 85.93.138.132 Message-ID: <42cbc077@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1120649335 85.93.138.132 (6 Jul 2005 04:28:55 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed.utanet.at!reader.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail