I have a table which contains values for a collection of data. The value field thus contains multiple types of data - dates, numbers, text. One of the fields in the collection is a lookup to another unlinked table.
I can figure out the select for the collection but not how to also pull in the value from the unlinked table.
SELECT DISTINCT CFV.Value, CFV.CustomRecordsetId, CFV.CustomFieldId,
CF.Name, F.id, F.ShortFileName, F.DateFileOpen
FROM [DB].[dbo].[CustomFieldValue] CFV
inner join [DB].[dbo].[CustomField] CF on cfv.customfieldId=cf.id
inner join [DB].[dbo].[CustomRecordset] CRS on CRS.Id=CFV.CustomRecordsetId
inner join [DB].[dbo].[File] F on F.Id=CRS.RecordId
WHERE F.Id = 27519
AND CF.Id = CFV.CustomFieldId
AND CF.CustomFieldTypeId <> 23
AND CRS.customrecordid = 8
AND (cf.name = 'MedLienAcctNo'
OR cf.name = 'MedLienAmountBilled1' OR cf.name = 'MedLienAmt'
OR cf.name = 'MedLienAmtDue' OR cf.name = 'MedLienDateRec'
OR cf.name = 'MedLienDiagAmt' OR cf.name = 'MedLienListTF1'
OR cf.name = 'MedLienLKUPMedProvider1' OR cf.name = 'MedLienNotes'
OR cf.name = 'MedLienServFromDate1'
OR cf.name = 'MedLienServToDate1'
OR cf.name = 'MedLienTreatAmt')
I need to be able to pull out the data for only the 'MedLienLKUPMedProvider1'
and lookup a name field in an unlinked People table, i.e. People.Name where 'MedLienLKUPMedProvider1'=People.Id