Hi,
I get two weekly files 'StudySummary' and 'Recruitment'. 'StudySummary' contains a list of clinical studies, 'Recruitment' contains the organisations in our area with the dates they have recruited patients to those studies. (It’s all anonymised and in the public domain)
I’ve attached a stripped down version but I have no control over the format of the relevant fields.
Every study has one Main Specialty but it can have several All specialties. And – here’s where it gets tricky – they put all the specialties in one field. For example Study No 8513: The Main Specialty is “Mental Health” and the All Specialties field reads “Health services and delivery research, Mental Health, Primary Care” with the commas in the data. I know!
Specialties are related to Divisions (30 specialties in 6 Divisions) and I have a mapping table which shows that.
So, given that set-up, I can select a Division and easily find records where the Main Specialty maps to that Division. That’s query 1 in the database and that’s working fine.
Now I need to find records where the All Specialties field contains any of the Specialties related to the selected Division. I started something in query 2, but for the life of me I can’t figure out what to do. I do also have a query 0 which shows those related specialties, but there will be a different number of results in that query depending on the Division selected and I have no idea how (or even whether!!) to join qry0 to the tables in qry2. And I don't know what, if anything, to put on the criteria line. Some kind of complictated, nested IIF(inStr()....IIf... maybe!
Is it possible to get what I need from the data in this format? The real database has almost half a million recruitment records, so I need something that will work reliably.
I get two weekly files 'StudySummary' and 'Recruitment'. 'StudySummary' contains a list of clinical studies, 'Recruitment' contains the organisations in our area with the dates they have recruited patients to those studies. (It’s all anonymised and in the public domain)
I’ve attached a stripped down version but I have no control over the format of the relevant fields.
Every study has one Main Specialty but it can have several All specialties. And – here’s where it gets tricky – they put all the specialties in one field. For example Study No 8513: The Main Specialty is “Mental Health” and the All Specialties field reads “Health services and delivery research, Mental Health, Primary Care” with the commas in the data. I know!
Specialties are related to Divisions (30 specialties in 6 Divisions) and I have a mapping table which shows that.
So, given that set-up, I can select a Division and easily find records where the Main Specialty maps to that Division. That’s query 1 in the database and that’s working fine.
Now I need to find records where the All Specialties field contains any of the Specialties related to the selected Division. I started something in query 2, but for the life of me I can’t figure out what to do. I do also have a query 0 which shows those related specialties, but there will be a different number of results in that query depending on the Division selected and I have no idea how (or even whether!!) to join qry0 to the tables in qry2. And I don't know what, if anything, to put on the criteria line. Some kind of complictated, nested IIF(inStr()....IIf... maybe!
Is it possible to get what I need from the data in this format? The real database has almost half a million recruitment records, so I need something that will work reliably.