How to add a field from on table to another usign “Make changes to a thing?” – Need help


Hello everyone. Thanks for helping me.

I’m having a problem with “make changes to a thing”. The problem is the following:

I have a table called “merchantClientUser”. This table stores all the user data.

On the other hand, I have the “merchantProduct”. This table stores all the product data.

In order to show my customers (the merchant) how many clients they have, I need to “add” a column from merchantClientUser called “productId”, which refers to the merchantProduct unique Id.

But for some reason, I can’t make the change to the thing and I don’t know why. Look…

image

In “productId field” I’m searching for merchantProduct to join with the unique id of this one. But, why it doesn’t happen?

Honesttly I don’t know what I’m failing for…

Thanks again, folks.

Disclaimer: The productId data type is merchantProductId, so it has to “copy” the field’s data from it, am I right?

image

Hi, Bruno!

So, let me see if I got it.

You have a User table (merchantClientUser). On this table you have a column called “productId”, that refers to all the products the user has under them.

Now, on your “MerchantProduct” table, do you have a column that references the User? This “unique id” that you are using in the MerchantProduct search is the unique id of the MerchantProduct?

Do you mind sharing the structure of these two tables?

Thanks for replying to me, stela.

The productId column refers to all the product the user has in relation to, as you said.

Yes, in merchantProduct I have a column that references the user, called clientId, as you see below

Yes, it is the uniqueId of merchantProduct table.

The basic structure of these two tables is the following:

No problem, hope I can help!

So, shouldn’t the constraint on the MerchantProduct search be “merchantClientUserId”? Since you’re getting a merchantClientUser unique id.



Source link

Leave a Comment