MSSQL query to graphical visualisation

I wish to integrate SQL query into grafana and I have a couple of doubts in it.
I have a table of variable types like below
opened_at | datetime2()
number | varchar(25)
resolved_at | datetime2()
closed_at | datetime2()
and I wish to have opened_at in x-axis and coalesce(closed_at, resolved_at) in y-axis for every value in number and I also wish to represent it graphically. Please help me with any ideas on how to query or any reference as I’m new to grafana