I'm currently writing a SQL statement which I have a slight problem with. The code involved is below but I'm looking to only use the first 10 characters of the dbo.FilteredContact.new_cl
acy field. So in order to do this I have the following as my last line of the query:
e AS CustomerTable_1 ON mid(dbo.FilteredContact.ne
10) = CustomerTable_1.CustomerNu
However SQL keeps throwing an error about the MID function and I'm wondering what I'd doing wrong here?
Any suggestions greatly appreciated.
SELECT dbo.FilteredContact.contactid, dbo.FilteredContact.new_clientreflegacy, PS_Integration.dbo.PS_Contact_Base.ContactGUID
FROM dbo.FilteredContact INNER JOIN
PS_Integration.dbo.PS_Contact_Base ON dbo.FilteredContact.contactid = PS_Integration.dbo.PS_Contact_Base.ContactGUID INNER JOIN
ANCHORSERV.S3CUSTDB.dbo.CustomerTable AS CustomerTable_1 ON dbo.FilteredContact.new_clientreflegacy = CustomerTable_1.CustomerNumber