Nov 26 2023 01:13 AM - edited Nov 26 2023 01:28 AM
Hello, I hope that you can help me with something that seems like it should be simple, but has me stumped! I am trying to create a new table from the table above. Each row is a vaccination record for a single patient. I would like to combine all records for a patient (in multiple rows) into a single record with additional columns, using the Hospital ID (patient ID) as the unique identifier for the new record. The only difference between the rows is the 'Vaccination Date' with each row representing a new dose of vaccine. So, for example, for the patient with Hospital ID# 37757, the new table would have 3 date columns. The maximum # of doses for any patient is 3. I also have the table in Excel.
The intended output is below. I have several x 1000 records, so I can't do it manually.
thanks All
Nov 27 2023 11:13 AM
Nov 28 2023 07:08 AM
Solution
It turned out that a crosstab will not produce the exact layout shown in your screenshot. However, a query with appropriate subqueries should do so. Note that this requires no more than 3 vaccinations in a series for one individual. More extended series would require more complicated logic.
This sample accdb and queries should show you how to prepare the display for the data in the layout illustrated.
Dec 02 2023 09:04 PM
Dear George, Thank you for your time and effort to assist me. It is very much appreciated. Your solution has worked very well.
Dec 03 2023 03:20 AM
Nov 28 2023 07:08 AM
Solution
It turned out that a crosstab will not produce the exact layout shown in your screenshot. However, a query with appropriate subqueries should do so. Note that this requires no more than 3 vaccinations in a series for one individual. More extended series would require more complicated logic.
This sample accdb and queries should show you how to prepare the display for the data in the layout illustrated.