Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Wiki Markup
Takes the parent SQL and adds the childDim to the grouping Clause, then returns the last entry ordered by childDim as an aggregation on aggExp. The resultset will not be expanded by the grouping level. It will only show the last entry from this additional query.
\\
Ideal for working with snapshot data, e.g. inventory. 
Syntax:
SUM ( LastChild ( aggExp, childDIm ))
\\
Example:select customerid,year(orderdate) as theyear, 
month(orderdate) as theMonth,
      sum(lastchild(freight, orderdate ))  as \[lastchild\]                                                 
from orders 
group by customerid,year(orderdate),month(orderdate)
order by customerid, year(orderdate),month(orderdate)
\\