Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Question relating to granularity... for optimal performance, here is my scenario:
I have table A, which includes PatientID, OrderID, and NurseID
I have table B, which is a detail of the Order, with OrderID and DrugID
Each OrderID in table A is 1 row of data. An OrderID in table b can have 1 to multiple rows, depending on how many DrugID's were ordered.
How do i merge these tables so they are using the same granularity?
Example:
table A:
OrderID 201
table B:
OrderID 201 DrugID 1
OrderID 201 DrugID 2
OrderID 201 DrugID 3
Thanks for any input.
- add PatientID and NurseID to TableB
- don't merge and stay with 2 tables
- concatenate
how would I add them
tableA:
load * inline [
OrderID, PatientID, NurseID
201, P1, N1
202, P2, N2
];
tableB:
load * inline [
OrderID, DrugID
201, DrugID 1
201, DrugID 2
201, DrugID 3
];
join (tableB)
load *
resident tableA;
DROP Table tableA;
Ok so I'm still new, but I asked a friend who's more experienced and he said that you should do a Left Join from Table 1 to Table 2
Left Join (Table1)
Load
OrderID,
DrugID;
From
[...\Datasources\Table2.qvd]
Edit: Just noticed someone else replied. Hope it worked!