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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:47:22+00:00 2026-06-05T04:47:22+00:00

I have db in MySQL, with two tables and I need to make query

  • 0

I have db in MySQL, with two tables and I need to make query like this

SELECT a.*, b.* from db1.A a1 left join db2.A a2 using(id) where a1.email <> a2.email

So i would like to find guys who has non empty email field in db1.A table and their emails does not match the same guys email from db2.A, and write emails from db1.A to db2.A.

in the beginning we have

db1.A          db2.A
email          email
www@ww.ww      NULL

in result ii would like to get

db1.A          db2.A
email          email
www@ww.ww      www@ww.ww

I can make it with any script language, but can it be done (such tasks) with help only SQL ?

  • 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-05T04:47:24+00:00Added an answer on June 5, 2026 at 4:47 am

    Seems to me it can be easily achieved by next query:

    update db2.A a2, db1.A a1 set a2.email=a1.email where a1.id=a2.id and (db2.email is null or db2.email = '') and a1.email <> a2.email;
    

    thanks everyone.

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

Sidebar

Related Questions

I have two MySQL tables something like this: tool_owners: tool_owners_id | user_id | ...
I need some help with a MySQL query. I have two tables, one with
I have two tables which I need to select all rows from where the
I have two MySQL tables and would like to select the highest value results
I have two MySQL tables named 'nodes' and 'joinTable' like shown below. I need
I am newbee with PHP and MySQL and need help... I have two tables
I have two MySQL tables: stats (left) and messages (right) +------------+---------+ +---------+------------+-----------+----------+ | _date
I have two tables that I need to join. These are: art id |
i want to make a mysql selection but i need to select two types
I have two tables, which I need to join by one column and is

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.