Automation - export query results as CSV - custom filename

I'm trying to figure out the best way to automate a query and save it as a csv file. The issue is that it's only doing a timestamp on the file and I am running a few different queries. So it's hard to see what file is what.

So I ended up just using the export wizzard and putting the query in there and it runs fine. Before I was doing an execute script, it would run but not save the file.

Any insight on creating a csv file name that is recognizable would help. And any insight to the - best - way to automate a query and save the csv.

Thank you

never mind..... select to file does this. Not entirely clear until you start trying all the options...

Glad you found the solution. Here are some videos on automation that might help answer future questions.