Skip to main content
added 166 characters in body
Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458

The problem is that multiple rows can be merged to create each AVG so you also need to find a way to combined the CreatedDate values of those multiple rows into a single value. I think the only choices are MIN or MAX so use:

ORDER BY MIN(ClosedDate)

or:

ORDER BY MAX(ClosedDate)

in your first query.

PS

As Adrian identified, this doesn't work with the LIMIT term present. So remove that or if its important you will need to find a different answer.

The problem is that multiple rows can be merged to create each AVG so you also need to find a way to combined the CreatedDate values of those multiple rows into a single value. I think the only choices are MIN or MAX so use:

ORDER BY MIN(ClosedDate)

or:

ORDER BY MAX(ClosedDate)

in your first query.

The problem is that multiple rows can be merged to create each AVG so you also need to find a way to combined the CreatedDate values of those multiple rows into a single value. I think the only choices are MIN or MAX so use:

ORDER BY MIN(ClosedDate)

or:

ORDER BY MAX(ClosedDate)

in your first query.

PS

As Adrian identified, this doesn't work with the LIMIT term present. So remove that or if its important you will need to find a different answer.

Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458

The problem is that multiple rows can be merged to create each AVG so you also need to find a way to combined the CreatedDate values of those multiple rows into a single value. I think the only choices are MIN or MAX so use:

ORDER BY MIN(ClosedDate)

or:

ORDER BY MAX(ClosedDate)

in your first query.