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 6927723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:05:33+00:00 2026-05-27T11:05:33+00:00

I load files in MySQL. Each file contains: Date ShopNumber subject price quantity total

  • 0

I load files in MySQL. Each file contains:

Date ShopNumber subject price quantity total

e.g. file1:

01/01/2011 Mexico Book1 $10 2 $20
01/01/2011 Mexico Book2 $10 2 $20
01/01/2011 Mexico Book3 $10 2 $20
...............................

file2:

01/01/2011 Mexico Book4 $10 2 $20
01/01/2011 Mexico Book1 $10 1 $10
...............................

In MySQL table:

01/01/2011 Mexico Book1 $10 3 $30
01/01/2011 Mexico Book2 $10 2 $20
01/01/2011 Mexico Book3 $10 2 $20
01/01/2011 Mexico Book4 $10 2 $20
...............................

The problem is: I have to track the source file and I cannot include source file to unique key of table – I need only keep totals.
Duplicates are rare. May be possible add another table that will keep only duplicates? Thanks.

  • 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-05-27T11:05:34+00:00Added an answer on May 27, 2026 at 11:05 am

    My application includes import functionaly and here is the way I solve the problem of loading data into MySQL and tracking information.

    • when the user uploads a file the application re-formats it to the tab-separated uft8-encoded valid temporary file
    • the name of the file and some other meta information about the import the application inserts into a separate table import_info and retrieves its id (update_id)
    • then the application loads the data from the file using LOAD DATA INFILE query to which it passes the path to the file and the update_id (attr1, attr2, attr3 come from file, update_id comes from parameter to the query)

      LOAD DATA LOCAL INFILE %(file_path)s
      INTO TABLE importdata
      CHARACTER SET 'utf8'
      (attr1, att2, att3, update_id)
      SET update_id = %(update_id)s;
      
    • the importdata table in my case allows duplicates which the application merges in other tables after the data is imported. If the merge is successful, I remove the imported data from the importdata table.

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

Sidebar

Related Questions

I was trying to load a data file into mysql table using LOAD DATA
Trying to load a small .txt file into mysql but get all my data
I would like to load some data stored in a file into my mysql
I try to load files in different categories according to theis file name. Till
Scenario: I load some data into a local MySQL database each day, about 2
I'm uploading files (images) to my file structure using Uploadify, then catching each file,
I have several excel files carrying 90 columns and about 500 rows, each file
In the db, there are projects. Each projects has files. Each file has multiple
I need to import largish (24MB) text files into a MySQL table. Each line
I'm using file_get_contents('mysourcefile.html') to load the contents of mysourcefile.html into mysql db. I have

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.