Hello,I am using SQL Server 2014. I have two table the first one is Table_A and Table_B.I want to copy row(s) from Table_B into Table_A based on a condition. The first condition is a sequence number "OYHSSQA" and the second is Type "OYNMTP" I want to have the row from Table_B copy to Table_A. The sequence number "OYHSSQA" will appear twice, but the Type "OYNMTP" will have a unique letter ("A" or "S") I want to have the combine condition for example:From Table_BOYHSSQA OYNMTP1578 A1578 SIf Table_A does not have both rows then I want Table_B to insert the rows into Table_A.I want both rows to appear in Table_A, below is my SQL query, but I unable to get any results. Any tips will be appreciated. Thank you in advanceSELECT OYHSSQ, OYNMTP, OYNAME, OYADD1, OYADD2, OYCITY, OYSTAT, OYZIP4, OYCNTC, OYPHAR, OYPHXX, OYPH04, OYPHEX, OYFL18, OYADD3, OYCTID, OYCTCD, OYADD4, OYPHNAFROM TABLE_BWHERE NOT EXISTS (SELECT OYHSSQ, OYNMTP, OYNAME, OYADD1, OYADD2, OYCITY, OYSTAT, OYZIP4, OYCNTC, OYPHAR, OYPHXX, OYPH04, OYPHEX, OYFL18, OYADD3, OYCTID, OYCTCD, OYADD4, OYPHNA FROM Table_AWHERE TABLE_B .OYHSSQ = Table_A.OYHSSQ AND TABLE_B .OYNMTP = Table_A.OYNMTP)
↧