×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Update a table with data from a select

Update a table with data from a select

Update a table with data from a select

(OP)
I have a table that has some poorly formed data. A person can read it and understand it well enough to know what the person entering the data meant. Any program I make has lots of problems with it so I need to fix this data.

I can create a select statement that uses the poorly formed data and with a concatenate and data from other columns in the same record is able to display the data as it should have been entered.

My question, how do I take data from a select statement and use it in an update statement? Or is there a different approach that would be easier to solve this problem? I should only need to do this once so a workaround that may not be standard would be fine.

Thanks

RE: Update a table with data from a select

(OP)
I was trying what you posted and several variations, when I did not have any luck getting them to work with my database(SQLite3) I posted, thinking that I was overlooking something simple.

What I came up with that worked is just have the select display what I need as SQL, copy it to a batch file then run the batch file with the database. It is not pretty, but it does solve my problem and with luck I will not have to do this again.

Thanks for the sujection. For anyone else who has a problem like this and does not mind a workaround, this is what I came up with.

CODE

select "update DataBaseName set PoorlyFormedColumn='" || PoorlyFormedColumn || OtherColumn || "' where rowID=" ||rowID from DataBaseName WHERE PoorlyFormedColumn <> PoorlyFormedColumn || OtherColumn

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close