Jump to content

Trouble denormalizing -- help with JOIN


phripley

Recommended Posts

Am trying to denormalize a table.

 

Can't seem to get UPDATE w/ JOIN correctly

 

What I have now:

 

exhibits_table

exhibit_id

1

2

3

 

 

related_exhibits

related_from_id  | related_to_id

1                      | 2

1                      | 3

2                      | 1

 

 

 

What I am looking to do is move the data from the related_exhibits table into a single concatenated field in the exhibits_table:

 

 

exhibits_table

exhibit_id  |  related_id

1              |  2,3

2              |  1

 

 

I thought I would want something like this:

 

UPDATE related_exhibits

LEFT JOIN exhibits_table

ON exhibits_table.exhibit_id = related_exhibits.related_from_id

SET  exhibits_table.related_id = CONCAT_WS(",", exhibits_table. related_id, related_exhibits.related_to_id)

 

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

Why:

 

We are moving the data into a CMS.  There's no easy want to get the CMS to work with the join table.  But it will handle the joins when they are called as described above.

 

 

 

I don't know what that means... you mean to say your CMS can only handle unnormalized tables?

Link to comment
Share on other sites

Not exactly fenway, it doesn't handle many to many self relationships in a way that has an acceptable UI.

 

Actually to tell the truth the denormalization I am doing is an interim step before we do something else with the data, but I am not involved with the something else directly. I was just told to deliver it in a single delimited column.

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.