I have 2 tables that I've Joined, One contains "Materials" and the other contains "Moldings". They are joined by the Material ID.
I want the end result to be a table of all of the unique materials being used.
The issue I'm running into is that the materials have lengths in the name. (eg. 10' Maple, 8' Maple) and I would like to exclude them when getting unique materials.
What I get now:
10' Maple
8' Maple
3' Maple
7' Cherry
What I want:
Maple
Cherry
What I have now is my attempt at getting rid of the numbers as it selects the table. Though my limited SQL knowledge is making it difficult.
SELECT LTrim(Right([CxMaterial].[Name],Len([CxMaterial].[Name])-5)) AS [EditedMaterial]
FROM [Molding] INNER JOIN
[CxMaterial]
ON [Molding].[Material ID] = [CxMaterial].[ID]
GROUP BY [EditedMaterial]
The RIGHT and LEN are to get rid of the numbers The Trim is to trim the spaces (as some have 2 digits and some have 1)
The main errors are "you tried to execute a query that does not include the specified expression 'LTRIM(...-5))' as part of an aggregate function"
and a bunch of syntax errors when I attempt to fix that problem
Any help is appreciated Thank you