可能重复:
Removing Duplicate row from a table based on one column
我创建了一个包含4个表中多个内部联接的表,但结果会带回重复记录。这是我正在使用的代码
DataSet quotetobepostedlist = DataRepository.Provider.ExecuteDataSet(System.Data.CommandType.Text,
"Select tblLoadStop.LoadID
, tblCustomer.CustomerID
,tblLoadMaster.Salesperson
,OriginationState
, DestinationState
,LoadRate
FROM tblLoadMaster
INNER JOIN tblLoadSpecifications ON tblLoadSpecifications.LoadID=tblLoadMaster.LoadID
INNER JOIN tblLoadStop ON tblLoadStop.LoadID=tblLoadMaster.LoadID
INNER JOIN tblStopLocation ON tblStopLocation.StopLocationID=tblLoadStop.StopLocationID
INNER JOIN tblCustomer ON tblCustomer.CustomerID =tblLoadMaster.CustomerID
WHERE tblLoadMaster.Phase LIKE '%2%'
ORDER BY tblLoadMaster.LoadID DESC;");
这是我得到的结果
Load ID Customer Salesperson Origin Destination Rate
13356 FedEx Alex Duluth New York 300
13356 FedEx Steve Florida Kansas 400
我只想显示第一行,
13356 FedEx Alex Duluth New York 300
并删除底行
13356 FedEx Steve Florida Kansas 400