从数据库中检索数据 [英] Retrieving data from database

查看:89
本文介绍了从数据库中检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好



我正在开发一个临床实验室系统项目,其中我添加了类别:尿液检查等。

然后在这个类别下我添加了多个子类别,并且在这些子类别下我使用主要外键添加了多个测试,现在在生成报告时,当我从下拉列表中选择主要类别作为尿液检查时,我希望此类别下的子类别将以标签显示,并且我希望显示这些标签下的子类别下的测试。如何在不知道所用标签数量的情况下检索此类数据,多个数据。

任何人都可以建议。



感谢

Jasbeer Singh

Hello

I am developing a clinical laboratory system project, in which i have added category as: Urine Examination , and etc..
then under this category i add more than one sub category,, and under those subcategories i add more than one tests using primary-foreign keys, Now while generating report, when i select Main category from dropdownlist as Urine Examination, I want that the sub categories under this category will be shown in labels and with those labels i want to show the tests which come under the subcategory. how to retrieve this type of data, multiple data without knowing the number of labels used.
Can anybody Suggest something.

Thank
Jasbeer Singh

推荐答案

您需要在主类别等不同表格中对微扩展和宏扩展进行分类,并为其提供任何唯一ID。现在只需在您的子类别表中引用这些ID。



您必须使用两张桌子 - >



1)Main_Category - > M_ID,M_Name



2)Sub_Category - > S_ID,姓名,M_ID



然后使用查询 - >从Main_Category m,子类别中选择m.M_NAME,s.S_NAME,其中m.M_ID = s.M_ID,M_Name ='microexpansion or macroexpansion'
You need categorized microexpansion & macroexpansion in different table like Main Category and give them any unique ID. Now just reference these ID in your sub-categories table.

You have to use two tables-->

1)Main_Category--> M_ID,M_Name

2)Sub_Category--> S_ID,Name,M_ID

then use the query--> select m.M_NAME,s.S_NAME from Main_Category m,Subcategory s where m.M_ID = s.M_ID and M_Name= 'microexpansion or macroexpansion'


这篇关于从数据库中检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆