mpspillers
Programmer
Hi! I'm making the big switch from MS Access to SQL, and I'm having a hard time translating one of my old Access queries to SQL syntax.
I have 2 tables, [tblPerson] and [tblTitles]. I want to see every record in [tblPerson] where the [tblPerson].[role] field CONTAINS (is LIKE) any of the [title] fields in my [tblTitles] table (multiple records). Here is what it looked like in MS Access:
SELECT tblPerson.LastName, tblPerson.FirstName, tblPerson.Role
FROM tblPerson, tblTitles
WHERE (((tblPerson.Role) Like "*" & [tblTitles].[title] & "*"))
GROUP BY tblPerson.LastName, tblPerson.FirstName, tblPerson.Title;
(the group-by prevents the cross-join from returning dupe results for some of the tblPerson records.)
Worked like a charm in MS Access, but there are so many differences in SQL syntax with this type of query that I'm having a VERY hard time translating. I believe I need to place a subquery inside my LIKE wildcards. Is the same effect even possible in SQL?
Any advice would be much appreciated!
Michael
I have 2 tables, [tblPerson] and [tblTitles]. I want to see every record in [tblPerson] where the [tblPerson].[role] field CONTAINS (is LIKE) any of the [title] fields in my [tblTitles] table (multiple records). Here is what it looked like in MS Access:
SELECT tblPerson.LastName, tblPerson.FirstName, tblPerson.Role
FROM tblPerson, tblTitles
WHERE (((tblPerson.Role) Like "*" & [tblTitles].[title] & "*"))
GROUP BY tblPerson.LastName, tblPerson.FirstName, tblPerson.Title;
(the group-by prevents the cross-join from returning dupe results for some of the tblPerson records.)
Worked like a charm in MS Access, but there are so many differences in SQL syntax with this type of query that I'm having a VERY hard time translating. I believe I need to place a subquery inside my LIKE wildcards. Is the same effect even possible in SQL?
Any advice would be much appreciated!
Michael