ChatGPT saves the day

therealbrandonwilson • 17 Jun 2025 •
While I insist on writing my weekly newsletter without AI assistance (save for an occasional brainstorming session for headlines), I have no reservations using ChatGPT to help with SQL queries. In fact, I would not have been able to deliver for my client today without it.
My client has a deliverable to send a novel report to the government today. The final query is supposed to pull together priorities, reasons, and actions for each record. The kicker is that there may be multiple/repeated reasons and actions, and the requirement is to consolidate, concatenate, and display them in the proper order. The report manager reached out this morning and said he had challenges with this final piece.
I took his code and popped it into ChatGPT o4 mini high with the request. At the same time, the report manager was continuing to refine his query. He provided a revision where everything was sorted except the reasons. I took his revised query to ChatGPT, and it suggested a common table expression (CTE). This expression allows for subqueries to pull data and then organize it accordingly. I sent him the result, and after making a couple of minor tweaks, he said it worked like a charm, including a high-efficiency run of 117K records in about seven seconds.
While I have used simple CTEs, it would have taken me several hours to arrive at this result on my own. Time was of the essence because the deadline for submitting the report is this afternoon, and I was able to help him achieve the result in less than 30 minutes.
I gave credit where credit is due. Some guy named Al can sure be helpful.
Comments
ChatGPT can be a life-saver (literally saving us hours of life). I used it a number of times for Excel queries because there’s no way in hell I have the time to deep dive into Excel for minor features I want to use.
I’m sometimes tempted to return to my legal job just to use AI. The amount of hours and after working hours I could have saved and spared on admin work is 🫨 Not to mention the billable hours I could have saved clients…