Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: compare two rows Date: Sun, 26 Oct 2014 10:49:29 +0100 Organization: Erland Sommarskog Lines: 29 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="033ac5a0907689904aec6a4990ff1e17"; logging-data="19361"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Xo7nOGv+lZq1+Z0lICMqd" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:bZQMTMG4kqf8g4IN3jEa8Ewd7v0= Xref: csiph.com comp.databases.ms-sqlserver:1821 seb (gekonik@poczta.fm) writes: > i have 2 rows ,who have the same value but in other columnes how to > check diffrence betwwen them > > example: > > 2,'something',something2,null,6 > 3,'something5',something8,6,7 > > the same value is 6 how to check in wchich columnes is diffrent bettwen > them? > I'm not sure that this makes any sense to me. Two rows, the value 6 appears in both, but in different columns? And? A table is supposed to model a unique entity and each column is supposed to model a unique attribute of that entity. So if on one row, the column apple has the value 6, and on another row the column orange has the value 6, you would still be comparing apples and oranges. So maybe your real problem is that your database design is not the best one. But apart from that, I don't really understand "wchich columnes is diffrent bettwen them?". In the example above, what output do you want? -- Erland Sommarskog, Stockholm, esquel@sommarskog.se