Trouble Plotting Time Series Graph

Hi there,
I want to make a graph that plots the timestamp of an account being created in a database, against the cumulative number of customer accounts created. So ultimately it should show the progression of accounts created over time. I’m pulling from a SQL server database.

the table with this information is ‘Acct_Prod’ and ‘time_created’ would be on the x axis, with ‘customers’ on the y axis. Here’s my code so far.

with data as
(
select min(time_created) as time, count(*) as customers
from [ESP_MANAGER_DB].[dbo].[Acct_Prod]
– order by min(time_created)
)
select time,
sum(customers)
from data
order by time

The error message says: " mssql: Column ‘data.time’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. "

I commented out the order by clause in the subquery because it said aggregate functions are not allowed in ms sql server subqueries, views, etc.

Am I on the right track here? Not sure if my code is wrong. I’m new to Grafana so any help would be great. Thanks.