Forum Moderators: open

Message Too Old, No Replies

Creating a SET field in table B from data in table A?

Is this possible?

         

HughMungus

10:00 pm on Dec 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it possible and relatively easy to have a SET column in one table that's created from data in a column in another table? I know this can be done when you create the table but I want the SET list to be dynamically updated anytime I update info in the other table.

For example, I have names of retailers in Table A with affiliate link, type of widget, etc. In Table B I have a list of sales that are coming up. I want to be able to have a dropdown list of retailers in Table B that is a complete list of retailers listed in Table A and I want that list to be dynamic such that if I add a new retailer in Table A I want it to be a selection in the SET drop-down in Table B.

I wonder if it wouldn't be easier to just create a form to use to add the upcoming sales (wherein I could just go get the list of retailers for the drop-down selection list from Table A without having Table B have to have a dynamic SET list).

Thoughts?

syber

10:17 pm on Dec 16, 2005 (gmt 0)

10+ Year Member



What do you mean by SET LIST?

HughMungus

10:56 pm on Dec 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SET list - like an ENUM field but works like a dropdown instead of a radio button.

I decided to just create a form to add new data. I'm pretty sure I read somewhere that you shouldn't enter data directly into your DB anyway...

Still, I'd be curious to know if this is possible...perhaps with a linked table?

syber

4:53 am on Dec 17, 2005 (gmt 0)

10+ Year Member



It's pretty straight forward to use ASP or PHP to create a dynamic dropdown list using the SELECT tag. For instance, you could have a dropdown list of countries that is dynamically created from the country table. When the user selects the appropriate country, the country code is placed into the local table as a foreign key to the country table.

HughMungus

7:42 pm on Dec 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's pretty straight forward to use ASP or PHP to create a dynamic dropdown list using the SELECT tag. For instance, you could have a dropdown list of countries that is dynamically created from the country table. When the user selects the appropriate country, the country code is placed into the local table as a foreign key to the country table.

That's what I'm doing. Much easier.

Still, anyone know if it's possible to do what I originally asked?