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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:20:56+00:00 2026-05-25T12:20:56+00:00

We have 2 price files one from last year, and a new one from

  • 0

We have 2 price files one from last year, and a new one from this year. there are about 25000 rows in each, but have slightly different prices, and none of the items in this years file have UPC codes.

I need to combine the two lists, keeping the higher prices, when the cost and description is the same. If the higher priced item does not have a UPC in that row, I need to pull the UPC from a matching lower priced item if it exists. Then delete any other matches, so we have one clean list.

I would like to do this with PHP/MySQL

Any Suggestions or assistance would be greatly appreciated.

  • 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-25T12:20:57+00:00Added an answer on May 25, 2026 at 12:20 pm

    Since your want to do this with MySQL, I suppose the data is already in the DB, then this is just a SQL query:

    INSERT INTO NewPriceList (Price, Cost, Description, UPC)
    SELECT L.Price, L.Cost, L.Description, L.UPC
    FROM LastYear L, ThisYear T
    WHERE 
      L.Cost = T.Cost AND
      L.Description = T.Description AND
      L.Price > T.Price
    UNION
    SELECT T.Price, L.Cost, L.Description, L.UPC
    FROM LastYear L, ThisYearT
    WHERE 
      L.Cost = T.Cost AND
      L.Description = T.Description AND
      L.Price <= T.Price;
    

    Otherwise you’d have to do this manually in PHP (for each item of one list, search the corresponding item in the second list, take the columns you want and insert into your database) or insert the data into your database before executing the query.

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

Sidebar

Related Questions

I have a bunch of csv files. Each has data from a different period:
I have created one SSIS package from flat file I'm getting one price value.
I imported information from txt files. I have 3 files, and one field from
I have a 'price' variable that contains some integer number from a MySQL database.
I have a free shipping price rule which is configured like this: All customer
I have a class level price variable decalred inside a page, like this: public
I have a form that saves the price into the database but whn a
I have a custom plist file which contains dictionaries. Each dictionary contains information about
I have a piece of jquery which drags the value from a page. One
Alright, I have been breaking my head over this one for more than a

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.