Mysql expert needed...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acctman
    Confirmed User
    • Oct 2003
    • 2840

    #1

    Mysql expert needed...

    does anyone know how to merge to tables? Table1_members needs to receive all the fields and setting in Table2_users. anyone know hwo to do this merge either via shell or phpmyadmin
  • Baker Rd
    Confirmed User
    • Nov 2005
    • 647

    #2
    are the tables identical?
    money talks and bullshit walks.

    Comment

    • acctman
      Confirmed User
      • Oct 2003
      • 2840

      #3
      no not identical. they're both in the same database though. one is rate_members and the other is phpbb_users. i need all the fields with there settings from phpbb_users (with the exception of username and user_id, i'll drop those fields) moved/copied to rate_members.

      i've check both tables and there won't be a overlapping problem since all fields in phpbb_users are unique

      Comment

      • Baker Rd
        Confirmed User
        • Nov 2005
        • 647

        #4
        you can try something like this

        INSERT INTO rate_members (field1,field2,field3) SELECT field1,field2,field3 FROM phpbb_users
        money talks and bullshit walks.

        Comment

        • Fresh
          • Mar 2005
          • 4920

          #5
          the way we would do it is first create a duplicate of the destination via phpmyadmin (operations>copy table with data/structure) then write a simple php script to read the one you want to merge, and as you loop thru the results, import to the duplicate version passing only the variables that are required to make the entry valid in the copy. Once you confirm the data is correct, u can rename the tables via the same way (operations>rename) and make it live without any hiccups.


          Promote ONE Legal Tube Site, Collect Checks from 19 Sponsors

          Fresh Dave | Email: [email protected] | ICQ: 317160390


          Comment

          • StuartD
            Sofa King Band
            • Jul 2002
            • 29903

            #6
            Originally posted by Dave Guru
            the way we would do it is first create a duplicate of the destination via phpmyadmin (operations>copy table with data/structure) then write a simple php script to read the one you want to merge, and as you loop thru the results, import to the duplicate version passing only the variables that are required to make the entry valid in the copy. Once you confirm the data is correct, u can rename the tables via the same way (operations>rename) and make it live without any hiccups.
            This is me on facebook
            This is me on twitter

            Comment

            • acctman
              Confirmed User
              • Oct 2003
              • 2840

              #7
              ok i'll try the php script version, i know enough php to do something small like that. thanks

              Comment

              • acctman
                Confirmed User
                • Oct 2003
                • 2840

                #8
                i did some research looks like i need to use ALTER to add to an existing table

                ALTER TABLE table_name
                ADD column_name datatype

                Comment

                • Baker Rd
                  Confirmed User
                  • Nov 2005
                  • 647

                  #9
                  Originally posted by acctman
                  i did some research looks like i need to use ALTER to add to an existing table

                  ALTER TABLE table_name
                  ADD column_name datatype
                  heh, I totally misunderstood your question
                  money talks and bullshit walks.

                  Comment

                  • FuqALot
                    Confirmed User
                    • Dec 2001
                    • 3817

                    #10
                    Originally posted by Dave Guru
                    the way we would do it is first create a duplicate of the destination via phpmyadmin (operations>copy table with data/structure) then write a simple php script to read the one you want to merge, and as you loop thru the results, import to the duplicate version passing only the variables that are required to make the entry valid in the copy. Once you confirm the data is correct, u can rename the tables via the same way (operations>rename) and make it live without any hiccups.
                    Only non mysql experts would do that. If you really know mysql you could do it by using a query. Whenever I need stuff done I go to expertsexchange.com, post my question and within minutes i have a query.

                    Comment

                    • Baker Rd
                      Confirmed User
                      • Nov 2005
                      • 647

                      #11
                      Originally posted by FuqALot
                      Only non mysql experts would do that. If you really know mysql you could do it by using a query. Whenever I need stuff done I go to expertsexchange.com, post my question and within minutes i have a query.
                      unless there is data to change I also see no need for this, sql is very powerful and most php programmers hardly know how to do anything but INSERT and SELECT lol
                      money talks and bullshit walks.

                      Comment

                      • devilspost
                        Confirmed User
                        • Feb 2004
                        • 3980

                        #12
                        expertSEXchange.com hehe

                        Brothels and Escorts Worldwide.

                        Comment

                        • Nathan
                          Confirmed User
                          • Jul 2003
                          • 3108

                          #13
                          The real question here is: why in gods name do you want to do that?!

                          Either learn how to do joins, or if you use mysql 5, setup a damn view.
                          "Think about it a little more and you'll agree with me, because you're smart and I'm right."
                          - Charlie Munger

                          Comment

                          • Fresh
                            • Mar 2005
                            • 4920

                            #14
                            Originally posted by FuqALot
                            Only non mysql experts would do that. If you really know mysql you could do it by using a query. Whenever I need stuff done I go to expertsexchange.com, post my question and within minutes i have a query.
                            to each his own - if one of your buddies at expertsexchange gives you an incorrect query, its gonna fuck shit up

                            the safest way of going about it is as i described.


                            Promote ONE Legal Tube Site, Collect Checks from 19 Sponsors

                            Fresh Dave | Email: [email protected] | ICQ: 317160390


                            Comment

                            Working...