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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:03:08+00:00 2026-06-12T11:03:08+00:00

I am having trouble getting things moved in a database. I have two tables

  • 0

I am having trouble getting things moved in a database. I have two tables with different column names the one that is the same name is “zip” but they have the same data. I want to move from table A to table b if the zip code doesn’t already exist in table b. I am using mysql command line.

  • 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-12T11:03:10+00:00Added an answer on June 12, 2026 at 11:03 am

    USe INSERT INTO....SELECT

    INSERT INTO TableB(colName)
    SELECT colName 
    FROM    TableB b
            LEFT JOIN TableA a
                ON a.colName = b.colName
    WHERE   a.colName IS NULL
    

    TableA.colName will be NULL if it does not exists on TableB. just change colName to the columns names in your tables.

    UPDATE 1

    INSERT INTO skadate_location_city
        (
            Feature_int_id,
            Admin1_str_code,    
            Country_str_code,
            Feature_dec_lat,    
            Feature_dec_lon,
            zip
        )
    SELECT  
            a.city_id     AS Feature_int_id,
            a.state_id    AS Admin1_str_code, 
            a.country_id  AS Country_str_code,
            a.latitude    AS Feature_dec_lat,
            a.longitude   AS Feature_dec_lon,
            a.zip
    FROM    skadate_location_zip a
            LEFT JOIN skadate_location_city b
                ON a.zip = b.zip
    WHERE   b.zip IS NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting the right syntax for this. Say I have two
I'm trying to create my own plugin. But I'm having trouble getting things right.
im having trouble getting a string (containing a URL) from one activity to another.
Im having trouble getting my JTable that im using to display either check boxes
I have an absolute beginner question here. I'm having trouble getting multiple checkbox entries
I'm having trouble getting the CanExecute method of my command to work property. I've
I'm having trouble getting Tire working using ElasticSearch with the Bonsai addon on the
I'm currently having trouble getting example code for using tweepy to access Twitter's Streaming
I'm having trouble getting Japanese text to display properly on a website compiled using
I'm having trouble getting the server to recognize a JSON POST request since I

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.