本文介绍了连接两个表,结果两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的查询中有一条select命令,该命令从两个表中获取数据,结果的每一行都出现两次result,我的查询是
i have a select command in my query that fetch data from two table , and each row of result come twice in result , my query is
Select
Driver.DriverID,
Driver.FName,
Driver.LName,
Driver.SmartCardNumber,
Driver.DriverState,
Driver.DriverCity,
Driver.DriverAddress,
Driver.Mobile,
Driver.Telephone,
Driver.MelliCardNumber,
Driver.CertificatePublisher,
Driver.addeddate,
Driver.ContractorID,
Driver.editeddate,
Contractor.name
From Driver,Contractor
推荐答案
如果Driver和Contractor表之间存在关系,则需要满足条件.
you need where condition if Driver and Contractor tables have relationship between them.
类似
Select
Driver.DriverID,
Driver.FName,
Driver.LName,
Driver.SmartCardNumber,
Driver.DriverState,
Driver.DriverCity,
Driver.DriverAddress,
Driver.Mobile,
Driver.Telephone,
Driver.MelliCardNumber,
Driver.CertificatePublisher,
Driver.addeddate,
Driver.ContractorID,
Driver.editeddate,
Contractor.name
From Driver,Contractor
where Driver.ContractorID = Contractor.id
假设ContractorID链接到Contractor的ID.
assuming ContractorID is linked to the id of Contractor.
这篇关于连接两个表,结果两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!