Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble mapping category id's between tables

Status
Not open for further replies.

BaukeB

Programmer
Sep 4, 2007
2
NL
Hi,

I have to import all available categories from a pricelist en place them in my webshop.
Now the problem: the id's in the pricelist are alphanumerical, and de id's in my webshop must be integers.

This is what my DB looks like

I've created a TABLE that holds the pricelist:
TABLE pricelist
---------
Prod_id, major_id, minor_id, sub_id
001 AAA2005 BAC3256 GHD6254

And an extra table that holds all the category id's:
The 'shop_cat_id' is auto-increment INT(11):
TABLE categorie_mapping
-------
shop_cat_id, pricelist_cat_id
1 AAA2005
2 BAC3256
3 GHD6254

And it all has to go into this table:
TABLE categories
----------
shop_cat_id, parent_id
3 2
2 1

Major_id is the parent of minor_id and minor_id is of course the parent of sub_id

I thought that by using TABLE categorie_mapping, i could easily convert the category id's into integers. But I'm stuck with creating the SQL to put it in TABLE categories

Can anyone point me in the right direction? Help is really appreciated
 
I've created a workaround using PHP, the script works great now.

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top