Access Query; Creating Master/Slave from list

KauaiGirl

New Member
Asked a question a few days ago, but have decided to go down a differnt route so am re-doing the question as the edit's were getting a bit messy.I have a list of data containing two columns:\[code\]pID sKey100 8611100 2318101 3516101 5413102 6546102 5646102 8411103 8795103 5845\[/code\]The first sKey to appear would become the Master sKey for that pID and each sKey after would be a slave. The data would look like this.\[code\]pID sKey sKey_1100 8611 2318 101 3516 5413102 6546 5646102 6546 8411103 8795 5845 \[/code\]This query gets me close\[code\]SELECT MyTable.pID, MyTable.sKey, MyTable_1.sKeyFROM MyTable INNER JOIN MyTable AS MyTable_1 ON MyTable.pID = MyTable_1.pIDWHERE (((IIf([MyTable.sKey]=[MyTable_1.sKey],"Y","N"))="N"))pID sKey sKey100 2318 8611100 8611 2318101 3516 5413101 5413 3516102 5646 6546102 5646 8411102 6546 5646102 6546 8411102 8411 5646102 8411 6546103 5845 8795103 8795 5845\[/code\]But as you can see it reverses the order and doubles each one up, and when it hits an instance where there is 3 or more sKey's it goes a bit crazy :\Anyone have any ideas, or can point me in the right direction?
 
Top