-1

I have a select statements that outputs this:

[Total Days]
[991]
[127]
[664]
[889]

These values represent the total days each customer is registered. In this example I used 4 records, so to get the avarage I need to do ((991 + 127 + 664 + 889 ) / 4).

How to I achieve such thing in SQL?

SandPiper
  • 2,816
  • 5
  • 30
  • 52
Bader Ali
  • 21
  • 5

2 Answers2

1
SELECT AVG(Total_Days) AS Total_Days_Average FROM MyTable
SandPiper
  • 2,816
  • 5
  • 30
  • 52
0

Use below query,

SELECT (SUM(TOTAL_DAYS)/4) FROM TABLE_NAME;
Jim Macaulay
  • 4,709
  • 4
  • 28
  • 53