Solved

Create Insert Statement from inner join output

Posted on 2014-04-02
3
236 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now