Part of file name as a sql query value?

I am trying to figure out how to use a saved file name as part of the sql query to compete the query and then run it.

I have an sql statement that I use for another program to autocad and it uses a “WHERE =” that gets the = part based off the first 7 characters of the saved autocad file name and it works perfectly. I would like to recreate something like this for libreoffice but I am unsure how to map it to the file name as I cant insert a field into the query.

My goal is to be able to have WHERE = “SAVED calc file name” or really the first 7 digits of the file name as mine is Always a 7 digit number to start that is directly related to a Jobno field in the database.

I hope I understand your question. You have a table with a field containing a file name. You want the query to make the selection based upon the first 7 characters of the file name in that field. If so, then: