How lookup a value for TSQL Query.

Trysten
Trysten used Ask the Experts™
on
I am building a query in MSAccess 2013. I have a Table containing the names of documents, and a different Table containing the path these Documents reside in. I would like a query that concatenates the path with the name of the document. Perhaps something like
SELECT Documents.ID, (SELECT Val FROM Local_Config WHERE Key = 'Repo') & Documents.Name From Documents;

Open in new window

I think this is a basic SQL question that I just don't have the knowledge to answer.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
does the table " Local_Config" have a field corresponding to the Documents.ID field?

SELECT Documents.ID, (SELECT Val FROM Local_Config WHERE Key = 'Repo' and Documents.ID=Local_Config.ID) & Documents.[Name] From Documents;
Software Team Lead
Commented:
try

SELECT distinct a.ID,  b Val & a.Name as path
From Documents as a,
(SELECT Val FROM Local_Config WHERE Key = 'Repo') as b
Distinguished Expert 2017

Commented:
Make sure the path includes "\" at the end.  If it doesn't, you need to include one when you concatenate the path with the file name.
TrystenProgrammer

Author

Commented:
Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial