SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 32 of 32
  1. #26
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    Just forget about those two tables, the datasource column and your tecnical (impossible) solution for now. Please explain in your own words what you need this information for. Use examples if needed to clarify. Remember, we don't know anything about your project

    hi Guido, r937.com here is a sample of the structure of the table and the actual data. I hope this makes sense in any way. many thanks
    Attached Files Attached Files

  2. #27
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    If you're going to merge the two tables in the end, you might as well merge them immediately and add that datasource column only to the new (merged) table.

  3. #28
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Guido. So now that i have them merged what solution would you please suggest.
    Please share your solution with me am quite helpless at this point.

  4. #29
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by paul_paisley View Post
    At the end I would merge the two tables...
    that was my suggestion -- INSERT with ON DUPLICATE KEY UPDATE option
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #30
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have just researched the duplicate key update. I do not know how it to my present problem please hope am not asking too much on this matter. I need a clue at least then i can understand more

  6. #31
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Code:
    INSERT
      INTO server_log_data
         ( server_rmc_time 
         , server_rmc_date 
         , server_latitude 
         , server_longitude
         , other_columns
         , datasource ) 
    SELECT rmc_time      
         , rmc_date     
         , latitude     
         , longitude
         , other_columns
         , 'mobile' 
      FROM rmc_raw_data
    ON DUPLICATE KEY UPDATE data_source = 'both'
    don't forget you have to set up the 4-part index --
    Code:
    ALTER TABLE server_log_data
    ADD INDEX 
    ( server_rmc_time 
    , server_rmc_date 
    , server_latitude 
    , server_longitude )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #32
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    Code:
    INSERT
      INTO server_log_data
         ( server_rmc_time 
         , server_rmc_date 
         , server_latitude 
         , server_longitude
         , other_columns
         , datasource ) 
    SELECT rmc_time      
         , rmc_date     
         , latitude     
         , longitude
         , other_columns
         , 'mobile' 
      FROM rmc_raw_data
    ON DUPLICATE KEY UPDATE data_source = 'both'
    don't forget you have to set up the 4-part index --
    Code:
    ALTER TABLE server_log_data
    ADD INDEX 
    ( server_rmc_time 
    , server_rmc_date 
    , server_latitude 
    , server_longitude )

    Thanks for the suggestion. That means I have to populate all the entries to 'Mobile' in the rmc_raw_data for its datasource right? if i do this, then i select into the serverlog table to get 'both' on duplicate. This means any remaining entry that is unmatched, i would have to populate them with 'server'. Is this what it translates to or am i missing anything? meanwhile i would be running it and give you feedback soon. Thanks


Bookmarks

Posting Permissions

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