本文介绍了如何通过外键检索列数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个表[Test1-Test2]

Test1列:-
Test1Informations
Test1Data
Test1Company
TestID外键
Test1Code
Test1Image

Test2列:-
TestID主键
Test2Image
Test2Data
TestName

我想使用外键检索TestName值

i have 2 tables [Test1 - Test2]

Test1 Columns:-
Test1Informations
Test1Data
Test1Company
TestID Foreign Key
Test1Code
Test1Image

Test2 Columns:-
TestID Primary Key
Test2Image
Test2Data
TestName

i want to retrieve the TestName Value using foreign key

推荐答案

SELECT *
FROM Test1 INNER JOIN Test2
     ON Test1.TestID = Test2.TestID


那将带来所有匹配的行.有关联接的信息,请参见: http://www.w3schools.com/sql/sql_join.asp [ ^ ]


That would bring all the matching rows. For information about joins, see: http://www.w3schools.com/sql/sql_join.asp[^]



这篇关于如何通过外键检索列数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:48