Solved

Create Insert Statement from inner join output

Posted on 2014-04-02
3
245 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL  on Tomcat 8 89
Mysql Left Join Case 10 101
Very Large data in MYSQL 7 91
CLI command keep running after close 7 54
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
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://…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

680 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