Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8591845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:36:54+00:00 2026-06-11T23:36:54+00:00

I’m having a bit of a problem with a task I was assigned. I

  • 0

I’m having a bit of a problem with a task I was assigned.

I have this old phpmynewsletter database (MySQL backend).

Basically all emails are saved in a table with this structure:

    email   varchar(255)
    list_id int(11)
    hash    varchar(255)
    disclaimer1 tinyint(1)
    disclaimer2 tinyint(1)
    gender  char(1)
    dob date
    region  varchar(50)

So one same email can be present several times in the table, this is, subscribed in different newsletters (identified by list_id)

What I need to do is update the records so the fields disclaimer1, disclaimer2, gender, dob and region for a specific list_id are the same for the same email registered with other list_id’s.

For example:

    email: email1(at)gmail.com
    list_id: 1
    disclaimer1: 0
    disclaimer2: 0
    gender: M
    dob: 1975-05-02
    region: Portugal

and

    email: email2(at)gmail.com
    list_id: 33
    disclaimer1: 1
    disclaimer2: 0
    gender: M
    dob: 1975-05-02
    region: Portugal

How do I update the record with list_id 33 with the correct values from record with list_id 1?

I’m using PHP and I believe that running updates queries in loops is bad practise. The table has around 610000 records.

Hope somebody can give me some insight on how to accomplish this task.

Thanks,
Mário

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:36:55+00:00Added an answer on June 11, 2026 at 11:36 pm

    @bigman what you have posted seems to be right but I guess the question is on how to change all the other data similar to list_id: 1 with the same email.

    UPDATE my_table t,
     (
        SELECT
            email,
            disclaimer1,
            disclaimer2,
            gender,
            dob,
            region
        FROM
            my_table
        WHERE
            list_id = 1
    ) t1
    SET 
     t.disclaimer1 = t1.disclaimer1,
     t.gender = t1.gender,
     t.dob = t1.dob,
     t.region = t1.region
    WHERE
       t.email = t1.email
    

    I guess this should work for all the entries that would have the list_id: 1 email address.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I've tracked down a weird MySQL problem to the two different ways I was
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.