Libra Base - Ordering the COUNT field

Closed
BrianGreen Posts 1005 Registration date Saturday January 17, 2015 Status Moderator Last seen September 30, 2021 - Aug 19, 2016 at 04:03 PM
BrianGreen Posts 1005 Registration date Saturday January 17, 2015 Status Moderator Last seen September 30, 2021 - Aug 20, 2016 at 11:13 AM
Hi Guys,

Funny how I come back when I need more help ...

I have a Database in Libra Office. I have a query that counts the occurrencies of how many times a company contacts me. All I need is to present these counts in a decending order so the company that calls the most is at the top of the list and the one that calls the least is at the bottom.

Simple? I wish!

Heres the code i have in the Quer
SELECT COUNT( "Raw data".* ), "Raw data"."Company Name" FROM "Raw data" WHERE "Date" BETWEEN :First_Date AND :Last_Date GROUP BY "Company Name" ORDER BY "Company Name" DESC


Like always, thanks in advance for your help.

I really appreciate thank you messages as a payment for solving issues   :o)
Related:

1 response

Blocked Profile
Aug 19, 2016 at 07:28 PM
You have to order by the count, as it is the count that qualifies the list index.
BrianGreen Posts 1005 Registration date Saturday January 17, 2015 Status Moderator Last seen September 30, 2021 149
Aug 19, 2016 at 07:40 PM
Thanks for the reply Mark.

I did think of that, but I cant find a way of ordering the count. Is there a command that allows you to creats a count field? I couldnt find it. I thought of ordering by the "Raw Data" field, but Libra Base doesnt let me order that field.
Blocked Profile
Aug 19, 2016 at 08:29 PM
Try

Select Count("rawdata") as NumberOfTimes
.....
Order by NumberOfTimes
BrianGreen Posts 1005 Registration date Saturday January 17, 2015 Status Moderator Last seen September 30, 2021 149
Aug 20, 2016 at 11:13 AM
Libra hates me. I keep geting silly messages saying there is a syntax error. I have tried in both SQL view and Libras woeful Design mode but to no avail. However, my knowledge of SQL is only a couple of weeks old.