Subscribe to this thread
Home - General / All posts - Aggregates and DISTINCT
dyalsjas96 post(s)
#14-Feb-18 02:35

Continuing to work through Fehily 2016 using I completed the topic for aggregating distinct values but I'm not sure if I followed the exercise closely enough.

The aggregating distinct values text listing from Fehily was:




    SUM(DISTINCT price)


    AVG(DISTINCT price)


  FROM titles;

I was able to modify a separate text listing for MS Access that used a sub-query as a column expression.



      SUM([price]AS [SUM DISTINCT],

      AVG([price]AS [AVG DISTINCT]


          FROM [titles]);

Is this the most efficient query? If I read the user manual correctly, Manifold doesn't support modifying all aggregation functions with DISTINCT. Use cases for aggregating distinct values seem tenuous to me, but there may be implications when using big-data tables that I don't recognize.

The SQL statement compositions for Manifold 9 seem to follow MS Access conventions in unexpected places.



8,410 post(s)
#14-Feb-18 02:49

See Adam's explanation for departure from standard here (and surrounding posts).

And yes, it is the most efficient query.

dyalsjas96 post(s)
#14-Feb-18 03:03

Thank you. That helps (I think) Hmmm,

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.