我有顯示重複的結果,我不想要。我們有一個列調用addresstypes,它返回一個B或L,這取決於在db中輸入的內容。如果選擇B,則輸入數據是不正確的,因爲這是交付地址和法定地址。不顯示重複
當拉取數據,我得到的序列號等,但我得到一些兩倍......這有兩個B的地址數據& L.
這裏是我的查詢的人 - 我怎樣才能使雙列不顯示?
USE inventory
SELECT distinct
dbo.addressinfo.locationinfoid, dbo.equipmentlocationscurrent.serialnum, dbo.addressinfo.addresstype
FROM dbo.equipmentlocationscurrent
full join dbo.addressinfo
on dbo.equipmentlocationscurrent.locationinfoid = dbo.addressinfo.locationinfoid
where (clientName = 'cps lease')
and (locationtype = 'merchant')
and (addresstype = 'b' or addresstype = 'l')
order by serialnum
樣品超過包含在選擇列表中的任何列結果
locationinfoid serialnum
2887540 301-252-800 B
2887540 301-252-800 L
如果你想獲得不同的'locationinfoid'然後,哪'serialnum'和'addresstype'你想從重複的行顯示每個'locationinfoid'? – 2013-03-15 15:07:16
他們看起來不像重複。糾正我,如果我錯了 – matcheek 2013-03-15 15:07:42
它並不重要,這個報告,只是不是兩個 – jlongpre 2013-03-15 15:07:59