Join the tables, concatenate the strings and use LIKE
to look for the “certain text”.
SELECT p.path + '\' + d.filename
FROM documents d
INNER JOIN documentsinprojects dp
ON dp.documentid = d.documentid
INNER JOIN projects p
ON p.projectid = dp.projectid
WHERE p.path LIKE '%certain text%'
AND d.filename LIKE '%certain text%';
4
solved Microsoft SQL Server: how to put together these three tables? [closed]