Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6829945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:33:36+00:00 2026-05-26T22:33:36+00:00

How can I move a field from a the one table to the many

  • 0

How can I move a field from a the one table to the many table in a one-to-many relationship?

In our system we have a field that stores the address for an entire order (one ‘Order’ has many ‘OrderLineItems’). We now need to allow each ‘OrderLineItem’ in an order to store an address. For all orders up to this point everything was under one address so my idea was to simply set the address of each OrderLineItem to the address of its order.

  • We are using MySQL 5.5.17
  • Address is not a Foreign Key
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:33:37+00:00Added an answer on May 26, 2026 at 10:33 pm

    Not much detail in the question. What which sql server are you using?
    Is the address column a foreign key? What data type is it?

    Do this in SQL Server for each address column, replacing address_col_name with the actual column name and specifying any constraints. Execute statements one at a time:

    alter table OrderLineItem 
    add address_col_name address_col_type; 
    GO
    
    update OrderLineItem set address_col_name = o.address_col_name 
    from OrderLineItem as oli 
    join Order as o on oli.OrderID = o.OrderID; 
    GO
    
    alter table Order 
    drop column address_col_name; 
    GO
    

    There may be many other considerations but that is the basic code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my iPhone projects, I have three views that you can move
How can I move items from one list box control to another listbox control
Apparently I can't move files on different volumes using Directory.Move. I have read that
If I have several OS-X Terminal.app windows open, how can I move one Terminal
I want to move the field honk and it's data from one model to
I have two tables, Table_A and Table_B. Table_A has a one-to-many relationship with Table_B.
My Goal: Is to move data from one table to another if the row
I can move my pointer up and down one line with my arrow key
How can I move all files except one? I am looking for something like:
Does anyone know how I can programmaically move a registry from HKEY_LOCAL_MCAHINE to HKEY_CURRENT_USER?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.