C夏普内部连接没有共用键 [英] C Sharp inner join without common key

查看:85
本文介绍了C夏普内部连接没有共用键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两个表 tblUser tblHelpAndSupport ,数据库是SQL Server 2005.它们没有公共字段。 UserId是tblUser的主键。但是 tblHelpAndSupport 不包含UserId。我必须从 tblHelpAndSupport 中检索所有数据,其中条件是 tblUser 表中的UserId ='001'。如何在上述条件下检索数据?

There are two tables tblUser and tblHelpAndSupport and the database is SQL server 2005. They have no common field. UserId is the primary key of tblUser. But tblHelpAndSupport doesn't contain UserId. I have to retrieve all data from tblHelpAndSupport where the condition is UserId='001' in tblUser table. How can I retrieve data on the above condition?

推荐答案

它就像

It's as easy as
Select columnsYouWantFromBothTables
From tblUser , tblHelpAndSupport
Where tblUser.UserId = '001'





您不必指定连接 - 它将从User检索单行,并从HelpAndSupport检索所有orws



You don't have to specify a join - it will retrieve the single row from User and all orws from HelpAndSupport


这篇关于C夏普内部连接没有共用键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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