本文介绍了在GRIDVIEW中加入两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨我有两个表,第一个有很多字段,包括department_id。另一个有department_id和部门描述我想在gridview中显示第一个表字段,包括与department_id相关的部门描述 查询:
Hi i have two tables the first have many fields including department_id.The other one have department_id and department description i want to display in gridview first table fields including department description related with department_id Query:
SelectCommand="SELECT [report_no], [datesubmision], [complainee_name], [complainee_surname], [complainee_idnumber], [complainee_tel], [policynumber], [claimnumber], [typeofperson],[department_id],[status_id], [id] FROM [accusationform]" Please help me推荐答案
您好Nikolas, 以下是您可以使用的查询 Hi Nikolas, Here is the query you can make use of SELECT [acussfrm.report_no], [acussfrm.datesubmision], [acussfrmplainee_name], [acussfrmplainee_surname], [acussfrmplainee_idnumber], [acussfrmplainee_tel], [acussfrm.policynumber], [acussfrm.claimnumber], [acussfrm.typeofperson], [secfrm.department_name], --Here department name is replaced [acussfrm.status_id], [acussfrm.id] FROM [accusationform] AS acussfrm, [secondform] AS secfrm -- Rename secondform to your second table name WHERE [acussfrm.department_id] = [secfrm.department_id] --Here is the condition that reads the common data from two tables with having department_id as common id.
希望这对你有所帮助。 问候, RK
Hope this helps you a bit. Regards, RK
更多推荐
在GRIDVIEW中加入两个表
发布评论