问题描述
有两个表 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?
推荐答案
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夏普内部连接没有共用键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!