Hi,
Im working on a code to check whether similar value(partID) had been inserted in the column in the table "PartsList".
So basically it would check if the current partID already exist in the table. If yes (i.e exist) then update the partQty and price value for that particular part. If no (i.e the part is new/neven been inserted into the table before), then create new entry to insert the details into the table (i.e partID, partName, partQty, and price).
=====================================
partID | partName | partQty | Price
=====================================
11111 | Screw | 3 | 3
11112 | Bolt | 5 | 10
11115 | Cpr Wire | 2 | 18
Now I want to insert for example partID=11122 partName="Razor" partQty=8 Price=32. I want to check if the partID 11122 already exist in the table, in this case not. So if not then just add the new entry
=====================================
partID | partName | partQty | Price
=====================================
11111 | Screw | 3 | 3
11112 | Bolt | 5 | 10
11115 | Cpr Wire | 2 | 18
11122 | Razor | 8 | 32
If I want to insert for example partID=11111 partName="Screw" partQty=2 Price=2, check if the partID 11111 already exist, which is yes. Then it would update the table only for the partQty and the Price i.e
=====================================
partID | partName | partQty | Price
=====================================
11111 | Screw | [highlight #FCE94F]5[/highlight] | [highlight #FCE94F]5[/highlight]
11112 | Bolt | 5 | 10
11115 | Cpr Wire | 2 | 18
how can I do that? Sorry for long post, I cant describe it in good english. Any help is much appreciated. Thanks!
Im working on a code to check whether similar value(partID) had been inserted in the column in the table "PartsList".
So basically it would check if the current partID already exist in the table. If yes (i.e exist) then update the partQty and price value for that particular part. If no (i.e the part is new/neven been inserted into the table before), then create new entry to insert the details into the table (i.e partID, partName, partQty, and price).
=====================================
partID | partName | partQty | Price
=====================================
11111 | Screw | 3 | 3
11112 | Bolt | 5 | 10
11115 | Cpr Wire | 2 | 18
Now I want to insert for example partID=11122 partName="Razor" partQty=8 Price=32. I want to check if the partID 11122 already exist in the table, in this case not. So if not then just add the new entry
=====================================
partID | partName | partQty | Price
=====================================
11111 | Screw | 3 | 3
11112 | Bolt | 5 | 10
11115 | Cpr Wire | 2 | 18
11122 | Razor | 8 | 32
If I want to insert for example partID=11111 partName="Screw" partQty=2 Price=2, check if the partID 11111 already exist, which is yes. Then it would update the table only for the partQty and the Price i.e
=====================================
partID | partName | partQty | Price
=====================================
11111 | Screw | [highlight #FCE94F]5[/highlight] | [highlight #FCE94F]5[/highlight]
11112 | Bolt | 5 | 10
11115 | Cpr Wire | 2 | 18
how can I do that? Sorry for long post, I cant describe it in good english. Any help is much appreciated. Thanks!