I am trying to figure how to find the average of the data type datetime on my SQL Server. This is my code:
SELECT CONVERT(varchar, Tanggal_Produksi, 3) AS Tanggal_Produksi, Target, Actual, Balance, CONVERT(varchar, Waktu_Proses_Awal, 8)
AS Waktu_Proses_Awal, CONVERT(varchar, Waktu_Proses_Akhir, 8) AS Waktu_Proses_Akhir, CONVERT(varchar,
Waktu_Proses_Akhir - Waktu_Proses_Awal, 8) AS Waktu_Proses, Bulan, Tahun
FROM dbo.Histori_Produksi
This is the error I am getting:
Server: Msg 409, Level 16, State 2, Line 1 The average aggregate operation cannot take a varchar data type as an argument.
What does this mean, and what can I do to fix it?
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _