Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create Insert Statement from inner join output

Posted on 2014-04-02
3
Medium Priority
?
248 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 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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