我如何加入这两个表? [英] How Can I Join These Two Tables?

查看:65
本文介绍了我如何加入这两个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表(即tblperson和tbljob),我也有一个gridview。我想在gridview中显示来自tblperson的所有记录和tbljob中的一个字段。他们没有任何形成的钥匙...





我是ASP.Net的初学者。这是我今天在创建这个项目时面临的情景。请有人帮助我。谢谢:)

解决方案

您好,



使用以下查询



 选择 tblPerson。*,tblJob.Field1 来自 tblPerson,tblJob 其中   -   使用条件,如果你想要的。 





这是没有关系的交叉加入,使用这个,如果你有任何困惑那么你可以问我。


如果没有关系,连接将无法进行,但您可以使用union或union all来显示来自2 diff表的记录,但它将逐行显示....

I have two tables(namely tblperson and tbljob) and also I have a gridview. I want to display in my gridview all the records from tblperson and one field in tbljob. They do not have any key to form...


I am a beginner in ASP.Net. This is the scenario I am facing today in creating this project. Please someone help me. Thanks :)

解决方案

Hi,

Use below Query

Select tblPerson.*, tblJob.Field1 from tblPerson, tblJob where -- Use condition, if you want.



It is Cross join without relation, use this and if you have any confusion then you can ask me.


if there is no relation ,the joins will be not possible but you can use the union or union all to show the records from 2 diff table, but it will display in row by row....


这篇关于我如何加入这两个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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