[英]Display Data From 2 Table in GridView Asp.net
i have Two Table Like This 我有两个这样的桌子
Request Example UniTerm Example
St_Code 1 Id 1 2
St_Name FirstStudent Term 96-97 95-94
St_Family FirstFamily
and i have a Grid View contain St_Code,Name,Family and Term now the problem is i want to display all records of the student with the Just Last Record Term field in Term table i need gridview data like below 我有一个包含St_Code,Name,Family和Term的Grid View,现在的问题是我想用Term表中的Just Last Record Term字段显示该学生的所有记录,我需要如下的gridview数据
1 FirstStudent FirstFamily 96-97
show last record of the Term table and all of the Student table Records 显示Term表的最后一条记录和所有Student表的记录
i tried this SQL Code to select them 我尝试了此SQL代码以选择它们
SELECT Request.St_Code, Request.St_Name, Request.St_Family, UniTerm.Term FROM Student CROSS JOIN UniTerm ORDER BY UniTerm.Term DESC
its ok but shows all of the records in UniTerm table i need just last one! 好的,但是显示UniTerm表中的所有记录,我只需要最后一个!
thanks in advance 提前致谢
Just update your query 只需更新您的查询
SELECT Request.St_Code, Request.St_Name, Request.St_Family, UniTerm.Term FROM Student CROSS JOIN UniTerm ORDER BY UniTerm.Id DESC SELECT Request.St_Code,Request.St_Name,Request.St_Family,UniTerm.Term来自学生交叉加入UniTerm ORDER BY UniTerm.Id DESC
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.