Solved

Create Insert Statement from inner join output

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 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