Ask Your Question
0

Part of file name as a sql query value?

asked 2017-05-09 21:01:49 +0200

Ambient gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-05-09 23:51:38 +0200

Ratslinger gravatar image

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:

SELECT * FROM YOUR_TABLE_NAME WHERE SUBSTRING("FIELD_NAME",1,7) = '1234567'
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-05-09 21:01:49 +0200

Seen: 274 times

Last updated: May 09 '17