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

  • Home
  • SEARCH
  • 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 7429069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:54:40+00:00 2026-05-29T08:54:40+00:00

I generate reports through a web system that was built for the company I

  • 0

I generate reports through a web system that was built for the company I do most of my work for. Basically the web system tracks every hour I spend doing billable work. It generates CSV reports.

I am importing these reports into my own local mysql database, so that I can generate invoices from it. When I invoice, I’m putting two weeks worth of line-items (from the report) into the invoice. Then I’m marking the appropriate line-items as having been invoiced for.

My question is this: every time I download the report, it’s a complete report of all my work history. It’s cumbersome to edit the csv every time and remove everything I’m not interested in invoicing for, before importing that csv into my mysql database. Especially since in many cases, it can be months before I can invoice for a particular line item.

I’ve looked at the mysql pages for UPDATE, REPLACE … ON DUPLICATE UPDATE, etc. My head is about to explode and I don’t understand what I’m reading.

The goal is this: I want to be able to import the report today, invoice for a bunch of it and mark it as such. Then, I want to be able to download a new report say, tomorrow, with new content on it, and have only the new content imported. Old data shouldn’t be imported since it:
a) already exists in the database and,
b) may have been modified explicitly in the database, for example by marking "invoiced" in one of the columns, etc.

Umm.. help?

EDIT:
Ok, so if my CSV contains the following:
7,8,9,
4,5,6,
1,2,3,

And I import that into my database, then my table contains:
7,8,9,
4,5,6,
1,2,3,

and I can make edits/changes etc to the database.

I generate a new report later and my csv looks like this:
16,17,18,
13,14,15,
10,11,12,
7,8,9,
4,5,6,
1,2,3,


Now, I want to bring only the changes into my DB, as in, I want to only:
16,17,18,
13,14,15,
10,11,12,

so that my db now looks like my csv:
16,17,18,
13,14,15,
10,11,12,
7,8,9,
4,5,6,
1,2,3,


But I don't want to edit/change/touch those last 3 lines, because I may have a good reason for editing them or adding new data into them in my db (after importing them from the csv of course).

EDIT2:
I got it to work by flipping the order of my csv rows. New rows were being added to the top, meaning when I imported into my table, the id for the newest row was 1, which wasn’t helping the solutions below work well.

The code I’m using, that now works:

SELECT *
FROM lineitems_temp
LEFT OUTER JOIN lineitems
ON lineitems_temp.id = lineitems.id
WHERE lineitems.id IS NULL
ORDER BY -lineitems_temp.id

(this shows line items in lineitems_temp, which is the latest report, that aren’t present on lineitems, which is the old report. I think it’s possible also to use this mechanism to find lines that have been edited etc, in order to help manually keep things in sync.)

  • 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-29T08:54:41+00:00Added an answer on May 29, 2026 at 8:54 am

    Lets say you want to load the result in the table “a”
    1. Load the new csv into a temp table (b)
    2. Do a left outer join on b and a.
    (When we do a join, we will get all the elements in a and b.
    When we do left outer join, we will get elements in b, but not in a. This is what we want).
    3. Result from step 2, can be inserted in a. Use the same query or a temp table.

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

Sidebar

Related Questions

I have a web app (java, tomcat) that allows users to generate reports through
I use excel through vb.net/asp.net to generate reports from a web page and then
I'm trying to improve upon a utility that basically scan through all our reports
Any suggestions for an accurate Web Log analysis tool to generate reports on the
I've got a lot of mysql data that I need to generate reports from.
I’m developing an application dedicated to generate statistical reports, I would like that user
As a web systems programmer, I'd like to generate some reports and be able
We have a legacy VB6 application that uses Crystal Reports XI to generate printed
I have a web site that includes code to move data between databases, generate
I want to dynamically generate bands, that will then be grouped in reports. My

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.