Many to Many Or not?
Page 1 of 1
Many to Many Or not?
I am junior BI Developer here is the link which i opened I am in a confusion after couple of replies
On Expert said it is many to many one said it is not here is the link to follow
http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/74456b81-da34-49ac-8a23-d195eb6f7222
Normally in this case one patient should have many diagnosis and one diagnosis may be given to multiple patients. So you end-up with many-to-many relations.
In your case, you have many to many relationships.
Hi,
Nope, this what you are describing is not a case of many to many as you have the diagnosis recorder on each activity row so you can model it as a normal regular relationship.
However, as patients in fact do have several diagnosis this may indicate a problem in your fact table.
Regards,
Hrvoje Piasevoli
--------------------------------------------------------------------------------
MDX with Microsoft SQL Server 2008 R2 Analysis Services Cookbook by Tomislav Piasevoli
Hi HrvojePiasevoli ,
So this is not a Many to many relation thanks for your reply then what is many to many relationship I am a junior in DW modelling as of internet and books for example a author can write many books and one book can have many authors ,
a class can have many students and one student can be in many class,
what in my case one patient can have many diagnosis ,
one diagnosis can have many patients not to sure whether this is many to many ?
select PK_AEDiagnosisMF,AEDiagnosisMF_Code,PatientID,AttendanceDate
from
AandE.FactAandE
inner join
AandE.AEDiagnosisMF
on
AandE.AEDiagnosisMF.PK_AEDiagnosisMF=AandE.FactAandE.PK_FactAE
where PatientID=100015Results are
ID Dia_code P_ID Date
17 CF 100015 2005-03-27 19:36
18 CHI 100015 2006-10-19 18:52
19 CN 100015 2010-10-19 14:01
20 CO 100015 2011-08-09 08:22
select top 5 PK_AEDiagnosisMF,AEDiagnosisMF_Code,PatientID,AttendanceDate
from
AandE.FactAandE
inner join
AandE.AEDiagnosisMF
on
AandE.AEDiagnosisMF.PK_AEDiagnosisMF=AandE.FactAandE.FK_DiagnosisMF1
where AEDiagnosisMF_Code='CF'Result is
Here diagnosis Code CF has different patients is this not a many to many relation can you please explain why I coudnt bring my head around so confusing as this relates to the examples above book and authors,class room and students etc..
17 CF 100004 2011-09-24 13:25
17 CF 100038 2006-11-04 00:56
17 CF 10008 2011-12-19 16:31
17 CF 10011 2008-08-04 09:35
17 CF 100116 2006-11-20 15:12
cany any one suggest what relation is this
On Expert said it is many to many one said it is not here is the link to follow
http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/74456b81-da34-49ac-8a23-d195eb6f7222
Normally in this case one patient should have many diagnosis and one diagnosis may be given to multiple patients. So you end-up with many-to-many relations.
In your case, you have many to many relationships.
Hi,
Nope, this what you are describing is not a case of many to many as you have the diagnosis recorder on each activity row so you can model it as a normal regular relationship.
However, as patients in fact do have several diagnosis this may indicate a problem in your fact table.
Regards,
Hrvoje Piasevoli
--------------------------------------------------------------------------------
MDX with Microsoft SQL Server 2008 R2 Analysis Services Cookbook by Tomislav Piasevoli
Hi HrvojePiasevoli ,
So this is not a Many to many relation thanks for your reply then what is many to many relationship I am a junior in DW modelling as of internet and books for example a author can write many books and one book can have many authors ,
a class can have many students and one student can be in many class,
what in my case one patient can have many diagnosis ,
one diagnosis can have many patients not to sure whether this is many to many ?
select PK_AEDiagnosisMF,AEDiagnosisMF_Code,PatientID,AttendanceDate
from
AandE.FactAandE
inner join
AandE.AEDiagnosisMF
on
AandE.AEDiagnosisMF.PK_AEDiagnosisMF=AandE.FactAandE.PK_FactAE
where PatientID=100015Results are
ID Dia_code P_ID Date
17 CF 100015 2005-03-27 19:36
18 CHI 100015 2006-10-19 18:52
19 CN 100015 2010-10-19 14:01
20 CO 100015 2011-08-09 08:22
select top 5 PK_AEDiagnosisMF,AEDiagnosisMF_Code,PatientID,AttendanceDate
from
AandE.FactAandE
inner join
AandE.AEDiagnosisMF
on
AandE.AEDiagnosisMF.PK_AEDiagnosisMF=AandE.FactAandE.FK_DiagnosisMF1
where AEDiagnosisMF_Code='CF'Result is
Here diagnosis Code CF has different patients is this not a many to many relation can you please explain why I coudnt bring my head around so confusing as this relates to the examples above book and authors,class room and students etc..
17 CF 100004 2011-09-24 13:25
17 CF 100038 2006-11-04 00:56
17 CF 10008 2011-12-19 16:31
17 CF 10011 2008-08-04 09:35
17 CF 100116 2006-11-20 15:12
cany any one suggest what relation is this
kali786- Posts : 1
Join date : 2012-07-05
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|