Jump to content

Help merging 3 tables using lowest price


a_bains

Recommended Posts

Hello,

 

I have 3 tables consisting of products from suppliers, I am trying to merge all my supplier tables into one table. In the merged products table every product should be unique (all having different mfgpartno). Some suppliers carry the same product having the same mfgpartno as another supplier. The merged products table needs to only have the product containing the lowest price of all the 3 tables. In example, I need the entire row of the product with the lowest price between all 3 tables in the merged table. Here is an example based on the table below, the product with mfgpartno HA-MODEMCOM from table #3 would end up in the merged products table because it has the lowest price of all.

 

 

Table #1
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+
| mfgpartno            | manufacturer | vendorpartno | description                   | price | msrp | stock |
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+
| HA-MODEMCOM          | Asrock       |       HA-MOD | ASROCK AMR MODEM/COM PORT     |   6.3 |    0 | 0     |
| DUAL LOW PROFILE BRA | Asus         |       DUAL-L | LOW PROFILE BRACKET SUPPORT   |   9.6 |    0 | A     |
| AS/IO-PLATE          | Asus         |       IO-PLA | ASUS UNIVERSAL IO PLATE       |  12.6 |    0 | A     |
| 13-010041000         | Touch        |       K8N-DR | ASUS CPU RETENTION MODULE FOR |  16.1 |    0 | 0     |
| 319110               | Touch        |       SILVER | ARCTIC SILVER 5 HEAT COMPOUND |  28.6 |    0 | A     |
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+

Table #2
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+
| mfgpartno            | manufacturer | vendorpartno | description                   | price | msrp | stock |
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+
| HA-MODEMCOM          | Asrock       |       HA-MOD | ASROCK AMR MODEM/COM PORT     |   9.6 |    0 | 0     |
| DUAL LOW PROFILE BRA | Asus         |       DUAL-L | LOW PROFILE BRACKET SUPPORT   |  43.6 |    0 | A     |
| AS/IO-PLATE          | Asus         |       IO-PLA | ASUS UNIVERSAL IO PLATE       |  51.6 |    0 | A     |
| 13-010041000         | Touch        |       K8N-DR | ASUS CPU RETENTION MODULE FOR |  26.1 |    0 | 0     |
| 319110               | Touch        |       SILVER | ARCTIC SILVER 5 HEAT COMPOUND |  18.6 |    0 | A     |
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+

Table #3
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+
| mfgpartno            | manufacturer | vendorpartno | description                   | price | msrp | stock |
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+
| HA-MODEMCOM          | Asrock       |       HA-MOD | ASROCK AMR MODEM/COM PORT     |   4.2 |    0 | 0     |
| DUAL LOW PROFILE BRA | Asus         |       DUAL-L | LOW PROFILE BRACKET SUPPORT   |  63.6 |    0 | A     |
| AS/IO-PLATE          | Asus         |       IO-PLA | ASUS UNIVERSAL IO PLATE       |  41.6 |    0 | A     |
| 13-010041000         | Touch        |       K8N-DR | ASUS CPU RETENTION MODULE FOR |  26.1 |    0 | 0     |
| 319110               | Touch        |       SILVER | ARCTIC SILVER 5 HEAT COMPOUND |  38.6 |    0 | A     |
+----------------------+--------------+--------------+-------------------------------+-------+------+-------+

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.