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 8404565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:37:51+00:00 2026-06-09T22:37:51+00:00

This one is braking my head . Moving old articles rating for client from

  • 0

This one is braking my head . Moving old articles rating for client from old DB to new DB where the only reference between them is first word which is separated by dash in article title. I am able to pull the info I need by using SELECT but I cant figure out how to use the result to update the new table

table that needs to be updated

UPDATE 
newDB.newtable.rating
SET  newDB.newtable.rating.rating_count = oldvotes

the select that gives me the info on oldvotes

SELECT 
    oldvotes.votes AS oldvotes, old.title AS oldtitle,newtable.news_items.title as newtitle,newtable.news_items.id AS newID
FROM 
    oldDB.news_items AS old
INNER JOIN 
     oldDB.news_items.rating_count AS oldvotes 
ON 
     oldvotes.article_id = old.id
INNER JOIN 
      newDB.newtable.news_items
ON 
      newDB.newtable.news_items.title 
LIKE CONCAT
      (  '%', SUBSTRING_INDEX( old.title,  '- ', 1 ) ,  '%' ) 

any help is appreciated!

  • 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-06-09T22:37:52+00:00Added an answer on June 9, 2026 at 10:37 pm

    If I understand correctly, you have in old.title something like thisisauniquekey-september-2012, and in news_items.title the value ‘thisisauniquekey-somethingelse’.

    You could select a key (a faster key than the title) and the oldvotes into a temporary table, say, oldratings, using the same query you run now:

    SELECT news_items.keytobeusedonnewtable AS keyforrating, oldvotes.votes as oldvotes FROM etc.
    

    Then you can run the update using oldratings:

    UPDATE newDB.newtable.rating SET rating_value = oldvotes FROM
    newDB.newtable.rating JOIN oldratings
        ON rating.keyforrating = oldvotes.keyforrating;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm breaking my head over this one. I'm kind of new in android development.
This one's a head scratcher. I've created a commented jsFiddle to demonstrate the phenomenon
This one is a real head scratcher for me... var matches = Regex.Matches(<p>test something<script
This one has me scratching my head, so I'm hoping a second pair of
I am new to LINQ and am trying to sort this one out. I
this one is baking my head, i need an XML feed, but the feed
Alright, I have been breaking my head over this one for more than a
Breaking my head on this one.. Need to check if a get variable named
This one's got me stumped and it's driving me nuts. I have a SiteFinity
This one has me pretty rattled so I thank you in advance for your

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.