i不要重复值how to remove duplicate value in sql using inner join or left outer join...ex:select e.name,e.description,t.mobile ,m.address from employee e left outer join dept t on e.id=t.id left outer join mail m on m.id1=e.id1 ans:employee dept mail********......*****....*****id..id1.. name||id..descr||id1..address||1.. 1 ... sek ||1...chenn||.1... kovil2.. 2 ....ram ||2...ramm ||.2....streeans comingsek..chenn..kovilsek..rammm..streeram..chenn.kovilram..rammm.streei dont want duplicate value推荐答案 使用Select-Distinct子句(见 [ ^ ])。Use Select-Distinct clause (see[^]). 请检查此代码 Please check this codeDECLARE @Employee TABLE( ID int, ID1 int, Name nvarchar(10))INSERT INTO @Employee VALUES(1,1,'Sek')INSERT INTO @Employee VALUES(2,2,'Ram')DECLARE @Dept TABLE( ID int, [Description] nvarchar(10), Mobile int)INSERT INTO @Dept VALUES(1,'Chenn',1234567891)INSERT INTO @Dept VALUES(2,'Ramm',1234567891)DECLARE @Mail TABLE( ID1 int, [Address] nvarchar(10))INSERT INTO @Mail VALUES(1,'kovil')INSERT INTO @Mail VALUES(2,'stree')Select e.Name,t.description,t.mobile ,m.address FROM @employee e LEFT OUTER JOIN @Dept t on e.id=t.id LEFT OUTER JOIN @Mail m on m.id1=e.id1 这篇关于如何删除重复值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-26 08:44