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
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.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!