i have a table tbltrans
transno | agent name | date|
--------+-----------+-------
1 01 | waw |2014-10-10|
1 02 | waw |2014-10-15|
1 03 | waw |2014-10-20|
1 04 | waw |2014-10-30|
i want a query for postgresql that calculate the average time for agentname
the result is like this:
agent name | average time|
--------+------------
waw | 5days |
i hope somebody help me. . thanks and more power :)
Something like this: