Solved

Create Insert Statement from inner join output

Posted on 2014-04-02
3
247 Views
Last Modified: 2014-04-30
Hi I have some basic SQL that I use to check for duplicates.  What I need to do is write the results of the code to be a "1"in the same row.  I.e I want to be able to stamp the results of this "Check duplicates" as 1 1 in a column call "stamp".  Im new to all this thanks :)

select count(*) from activecampaign.em_subscriber
Inner join activefeed.6_subscriber
ON em_subscriber.email = 6_subscriber.`Email Address`

The above gets me my dupes now I just need to write 1 in the stamp columns for those contained in the above results
0
Comment
Question by:ncomper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Expert Comment

by:Terry Woods
ID: 39973510
The given query doesn't list duplicates as you say; it returns a single count of rows. Are you saying that where those tables match on the email address you want the activecampaign.em_subscriber.stamp column set to 1?
0
 
LVL 5

Author Comment

by:ncomper
ID: 39973563
yes sorry the code was meant to select * instead of count,  but yes that is correct
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 39973666
I believe this should do it. Please backup your data first, just in case you have any problems.
update activecampaign.em_subscriber
  join activefeed.6_subscriber
  ON em_subscriber.email = 6_subscriber.`Email Address`
set em_subscriber.stamp=1

Open in new window

0

Featured Post

Percona Monitoring and Management and Grafana

Proactive monitoring is vital to a highly-available environment. We have a quick start guide on Experts Exchange for Grafana users.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question