If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Sort Order of Update Query
I have two tables and I am updating columns in one from data in another one.
PnList table has a columns named as follows Pn 09950 10140 10240 020-989-014 020-989-015 020-989-016 020-989-017 step02 table as columns named Pn Shpef Socd sorted ascend ascend dedend 020-989-017 09950 ZD 020-989-017 09950 PD 020-989-017 10140 ZD 020-989-017 10140 PD 020-989-017 10240 ZD 020-989-017 10240 PD I am joining by the PN colum and selecting a value in Shpef and putting the Socd value in the columns 0995 10140 and so on one column at a time. to look like this Pn 09950 10140 10240 020-989-014 PD PD PD 020-989-015 PD PD ZD 020-989-016 PD PD ZD 020-989-017 ZD ZD PD now my delima, I am having problems when there are multible Socd's getting it to populate the same way everytime. one time it will use the first Socd value and other times it will use the last one. how can i get it to use either the first or last every time?? here is my update query UPDATE PnList INNER JOIN step02 ON PnList.Pn = step02.Pn SET PnList.[09950] = [socd] WHERE (((step02.Shpef) Like "09950")) WITH OWNERACCESS OPTION; |
Thread Tools | |
Display Modes | |
|
|