我正在尝试将两个 MS Access 表插入到一个 ms 访问表中。在两个表之一中,有一列包含重复值。我目前拥有的是:
Dim MySQL As String = "INSERT INTO XML_TEST_CASE (" & _ "TCParmId, " & _ "TestCase, " & _ "MessageType, " & _ "FileNo, " & _ "InstructionNo, " & _ "TransactionNo, " & _ "ElementNo, " & _ "MessageSection, " & _ "ElementLevel, " & _ "FullElementPath, " & _ "ElementValue, " & _ "ElementValueNew, " & _ "NameSpace, " & _ "NameSpaceValue, " & _ "Attribute, " & _ "AttributeValue, " & _ "TestCaseDescription) " & _ "SELECT " & _ "P.TCParmId, " & _ "P.TestCase, " & _ "P.MessageType, " & _ "P.FileNo, " & _ "P.InstructionNo, " & _ "P.TransactionNo, " & _ "S.ElementNo, " & _ "S.MessageSection, " & _ "S.ElementLevel, " & _ "S.ElementPath + S.Element, " & _ "S.ElementValue, " & _ "S.ElementValue, " & _ "S.NameSpace, " & _ "S.NameSpaceValue, " & _ "S.Attribute, " & _ "S.AttributeValue, " & _ "P.TestCaseDescription " & _ "FROM XML_TEST_CASE_PARAMETER P, XML_MESSAGE_STRUCTURE S " & _ "WHERE S.MessageType = P.MessageType " & _ "AND P.TestCase = '" & MyTestCase & "' " & _ "AND P.MessageType = '" & MyMessageType & "' " & _ "AND P.FileNo = " & MyFileNo & " " & _ "AND P.InstructionNo = " & MyInstructionNo & " " & _ "AND P.TransactionNo = " & MyTransactionNo & ";"
问题是,在 XML_MESSAGE_STRUCTURE 表中,S.ElementNo 有时会出现多次,然后导致我在目标表中针对特定的 ElementNo 获得了多个记录。这是我不想要的。
任何帮助都会受到重视。
里科