Avatar of nutnut
nutnut
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

SQL Join

Hi,

I have 2 tables.


TblA  Col1, Col2, Col3

TblB Col1, Col2, Col3

I need to join them BUT....

I need to return a row if ALL 3 Cols equal.

Col1= Col1
and Col2 = Col2
and Col3 = Col3

but

If ALL 3 Cols do NOT equal but

Col1 = Col1
and Col2 = Col2
and Col3 <> Col3

then return that row instead

So its sort of a double pass.  First pass is "do all 3 cols equal" if not "do Cols 1 & 2 equal", if not return nothing.

I am stumped, please help

Thanks

nutnut
Microsoft SQL Server.NET ProgrammingSQL

Avatar of undefined
Last Comment
nutnut

8/22/2022 - Mon