Compare two columns for difference mark the difference in mysql












1















I need to compare two fields and mark the similar fields in third table.



For Example:



Tables

customer:
phone id,
phonenumber
followstatus

received_Customer:
rc_id,
rc_phonenumber.


I need to mark the fdnumber with f or n/a in follow up which is in received and customer table.



update customer 
select b.phonenumber
from received_customer n
join customer b
on b.phonenumber = n.phonenumber
SET followUpStatus= 'y' ;


I run query in php.










share|improve this question





























    1















    I need to compare two fields and mark the similar fields in third table.



    For Example:



    Tables

    customer:
    phone id,
    phonenumber
    followstatus

    received_Customer:
    rc_id,
    rc_phonenumber.


    I need to mark the fdnumber with f or n/a in follow up which is in received and customer table.



    update customer 
    select b.phonenumber
    from received_customer n
    join customer b
    on b.phonenumber = n.phonenumber
    SET followUpStatus= 'y' ;


    I run query in php.










    share|improve this question



























      1












      1








      1








      I need to compare two fields and mark the similar fields in third table.



      For Example:



      Tables

      customer:
      phone id,
      phonenumber
      followstatus

      received_Customer:
      rc_id,
      rc_phonenumber.


      I need to mark the fdnumber with f or n/a in follow up which is in received and customer table.



      update customer 
      select b.phonenumber
      from received_customer n
      join customer b
      on b.phonenumber = n.phonenumber
      SET followUpStatus= 'y' ;


      I run query in php.










      share|improve this question
















      I need to compare two fields and mark the similar fields in third table.



      For Example:



      Tables

      customer:
      phone id,
      phonenumber
      followstatus

      received_Customer:
      rc_id,
      rc_phonenumber.


      I need to mark the fdnumber with f or n/a in follow up which is in received and customer table.



      update customer 
      select b.phonenumber
      from received_customer n
      join customer b
      on b.phonenumber = n.phonenumber
      SET followUpStatus= 'y' ;


      I run query in php.







      mysql update join






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 30 '14 at 11:51









      jynus

      11k11832




      11k11832










      asked Dec 30 '14 at 11:46









      Benson K BBenson K B

      83




      83






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Try the following:



          UPDATE customer b
          JOIN received_customer n
          ON b.phonenumber = n.phonenumber
          SET b.followUpStatus= 'y' ;




          share








          New contributor




          Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




























            0














            That is not the correct syntax for an UPDATE+JOIN. Try the following (assuming it is what you want, updating the table customer):



            UPDATE customer b
            JOIN received_customer n
            ON b.phonenumber = n.phonenumber
            SET b.followUpStatus= 'y' ;





            share|improve this answer
























            • Not Working .. ITs running on and on..

              – Benson K B
              Dec 31 '14 at 6:07











            • If you give us the structure of both tables I can help you with potential indexes to speed up the process like 1000x.

              – jynus
              Dec 31 '14 at 10:18











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "182"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f87237%2fcompare-two-columns-for-difference-mark-the-difference-in-mysql%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Try the following:



            UPDATE customer b
            JOIN received_customer n
            ON b.phonenumber = n.phonenumber
            SET b.followUpStatus= 'y' ;




            share








            New contributor




            Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

























              0














              Try the following:



              UPDATE customer b
              JOIN received_customer n
              ON b.phonenumber = n.phonenumber
              SET b.followUpStatus= 'y' ;




              share








              New contributor




              Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.























                0












                0








                0







                Try the following:



                UPDATE customer b
                JOIN received_customer n
                ON b.phonenumber = n.phonenumber
                SET b.followUpStatus= 'y' ;




                share








                New contributor




                Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                Try the following:



                UPDATE customer b
                JOIN received_customer n
                ON b.phonenumber = n.phonenumber
                SET b.followUpStatus= 'y' ;





                share








                New contributor




                Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share


                share






                New contributor




                Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 2 mins ago









                Ajeet KumarAjeet Kumar

                16




                16




                New contributor




                Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Ajeet Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.

























                    0














                    That is not the correct syntax for an UPDATE+JOIN. Try the following (assuming it is what you want, updating the table customer):



                    UPDATE customer b
                    JOIN received_customer n
                    ON b.phonenumber = n.phonenumber
                    SET b.followUpStatus= 'y' ;





                    share|improve this answer
























                    • Not Working .. ITs running on and on..

                      – Benson K B
                      Dec 31 '14 at 6:07











                    • If you give us the structure of both tables I can help you with potential indexes to speed up the process like 1000x.

                      – jynus
                      Dec 31 '14 at 10:18
















                    0














                    That is not the correct syntax for an UPDATE+JOIN. Try the following (assuming it is what you want, updating the table customer):



                    UPDATE customer b
                    JOIN received_customer n
                    ON b.phonenumber = n.phonenumber
                    SET b.followUpStatus= 'y' ;





                    share|improve this answer
























                    • Not Working .. ITs running on and on..

                      – Benson K B
                      Dec 31 '14 at 6:07











                    • If you give us the structure of both tables I can help you with potential indexes to speed up the process like 1000x.

                      – jynus
                      Dec 31 '14 at 10:18














                    0












                    0








                    0







                    That is not the correct syntax for an UPDATE+JOIN. Try the following (assuming it is what you want, updating the table customer):



                    UPDATE customer b
                    JOIN received_customer n
                    ON b.phonenumber = n.phonenumber
                    SET b.followUpStatus= 'y' ;





                    share|improve this answer













                    That is not the correct syntax for an UPDATE+JOIN. Try the following (assuming it is what you want, updating the table customer):



                    UPDATE customer b
                    JOIN received_customer n
                    ON b.phonenumber = n.phonenumber
                    SET b.followUpStatus= 'y' ;






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 30 '14 at 11:53









                    jynusjynus

                    11k11832




                    11k11832













                    • Not Working .. ITs running on and on..

                      – Benson K B
                      Dec 31 '14 at 6:07











                    • If you give us the structure of both tables I can help you with potential indexes to speed up the process like 1000x.

                      – jynus
                      Dec 31 '14 at 10:18



















                    • Not Working .. ITs running on and on..

                      – Benson K B
                      Dec 31 '14 at 6:07











                    • If you give us the structure of both tables I can help you with potential indexes to speed up the process like 1000x.

                      – jynus
                      Dec 31 '14 at 10:18

















                    Not Working .. ITs running on and on..

                    – Benson K B
                    Dec 31 '14 at 6:07





                    Not Working .. ITs running on and on..

                    – Benson K B
                    Dec 31 '14 at 6:07













                    If you give us the structure of both tables I can help you with potential indexes to speed up the process like 1000x.

                    – jynus
                    Dec 31 '14 at 10:18





                    If you give us the structure of both tables I can help you with potential indexes to speed up the process like 1000x.

                    – jynus
                    Dec 31 '14 at 10:18


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Database Administrators Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f87237%2fcompare-two-columns-for-difference-mark-the-difference-in-mysql%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Liste der Baudenkmale in Friedland (Mecklenburg)

                    Single-Malt-Whisky

                    Czorneboh