我有一个前段时间写过的查询返回一个计数。我现在想看看正在计算的行,但我似乎无法正确地查询我的查询。这是返回计数的查询。获取没有重复的行
select count(distinct f_Shipmentnumber) from t_shipment shipment
join t_Pilot pilot on pilot.f_PilotID=shipment.f_Pilot_ID
where pilot.f_ProviderID='12' and shipment.f_ShipmentType=2
and shipment.f_date > DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
这里是我想出了,但它返回重复的装运数量
select * from t_shipment shipment
join t_Pilot pilot on pilot.f_PilotID=shipment.f_Pilot_ID
where pilot.f_ProviderID='12' and shipment.f_ShipmentType=2
and shipment.f_date > DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
任何帮助将是巨大的。谢谢!!
那么你想看到当同一批货有一个以上的飞行员是什么? –
我只想看到shipmentNumber一次 –