在 Pascal 中连接 2 条记录的最佳方式是什么?
我对 Pascal 中的记录有一点问题。我正在编写一个程序,其中有两个记录列表:一个是患者,第二个是疾病,但我不知道如何加入它。我试图在患者列表中制作一个包含疾病 ID 的动态表,但拉扎勒斯在编译它时遇到了问题。如果有人帮助我,我会很高兴。
I've a little problem with records in Pascal. I'm writting a program where I've got two lists of records: one with patients and second with diseases but I don't have idea how to join it. I was trying to do a dynamic table with diseases id's in patient list but lazarus had problems with compiling it. I would be glad if someone helps me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一名患者可以患有多种疾病,许多患者可以患有一种疾病。
如果有关患者的记录描述了患者(例如出生日期)
有关疾病的记录描述了疾病(例如死亡发生率)
那么您需要关于每个患者的每种疾病病史的第三个记录列表(例如康复日期)。
使用 Patientid 作为指导,将第三个记录列表链接回患者,并使用疾病 ID 作为指导,将其链接回疾病。
现在您必须进行三向联接才能将所有相关信息放在一起。
如果我必须这样做,我会使用 SQL 而不是 Pascal。但还有使用数据库的开销。
One patient can have many diseases, and many patients can have one disease.
If records about patients describe patients (e.g. Date of Birth)
and records about diseases describe diseases (e.g. incidence of fatality)
then you need a third list of records about each patient's history with each disease (e.g. date of recovery).
It's not hard to link this third list of records back to patients, using patientid as the guide, and back to diseases, using diseaseid as the guide.
Now you have to do a three way join in order to get all the related information together.
If I had to do this I would use SQL rather than Pascal. But then there's the overhead of uisng a database.