Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2008
    Posts
    5

    Question Unanswered: a quick and simple(?) question about SQL commands

    This is a continuation from this thread (another website)

    So here is the deal. I am new to mysql but not new to webcode like php/html/flash/ect. I am moving roughly 30,000 users from a vBulliten database (the forum software this forum runs on) into phpprobid software, auction software. Basically signing up 30,000 users to this site for them and then giving them all a $3.00 credit to get the ball rolling. :-)

    Okay, so we are dealing with 1 database. The database already has 104 users so we have to add after that.


    probid_users = user table moving info into
    email = column moving info into
    users = user table moving info from
    email = column moving info from

    I tried using the below script:


    INSERT probid_users(
    email
    )
    SELECT u.email
    FROM user AS u
    LEFT JOIN probid_users AS pu ON pu.email = u.email
    WHERE pu.email IS NULL


    but all that happens is that is takes 341 seconds and then nothing. Nothing gets moved.

    Suggestions?

    Oh, and hi, I'm new to the community.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    suggestion:
    Code:
    INSERT IGNORE
      INTO probid_users
         ( email )
    SELECT email
      FROM user
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2008
    Posts
    5

    Question

    Quote Originally Posted by r937
    suggestion:
    Code:
    INSERT IGNORE
      INTO probid_users
         ( email )
    SELECT email
      FROM user
    Thanks! buuut... it added more string than needed, so, remember I am new here, when copying fields must you copy them all at once?

    I need to copy several fields....

    How do I do this?

    Thanks!

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    "it added more string" does not compute

    welcome to dbforums

    you will find that if you oversimplify the question, the answer will be oversimplified too

    enjoy your stay

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Feb 2008
    Posts
    5
    lol <3 coders

    um, okay I'm trying to copy the user table from my vb forum into my auction software on another url :P for their convenience and it'll jump start the site.

    eeep... help..

    INSERT probid_users(
    email
    )
    SELECT u.email
    FROM user AS u
    LEFT JOIN probid_users AS pu ON pu.email = u.email
    WHERE pu.email IS NULL

    that worked, can we do more than 1 column at a time? and if so how?
    Last edited by will500; 02-29-08 at 01:10.

  6. #6
    Join Date
    Feb 2008
    Posts
    5
    I guess I need to know how to get this:

    INSERT IGNORE
    INTO probid_users
    ( email )
    SELECT email
    FROM user

    to copy multiple fields at once?

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    SQL is a psuedo engliash language manipulation language
    so when you SELECT something you need to explicitly tell it waht to SELECT

    columns, or fields are supplied as a comma separated list
    INSERT IGNORE
    INTO probid_users
    (column1,clomun2,column3,....columnN )
    SELECT column1,clomun2,column3,....columnN
    FROM user
    Last edited by healdem; 02-29-08 at 04:14.

  8. #8
    Join Date
    Feb 2008
    Posts
    5
    yes I just found that out too, thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •