Copying fields from first line item to header in MySQL (5.7 on Amazon)

by hbquikcomjamesl   Last Updated July 11, 2019 18:06 PM

We have a header table ("opportunities") and a line-item table ("opportunity_details"). Each header record has 7 fields of vendor information that get copied from the first (by record-ID) line-item record.

Now, for new records, the application does this internally. But for some ten thousand older header records, this does not.

Now, if I had this problem on DB2/400 (or whatever IBM is calling it this week), I'd simply write a simple RPG "Cycle" program to do it. But it's not something I've had to do in MySQL.

Is there a pure SQL way to do this?

Tags : mysql-5.7 aws


Related Questions


Updated November 15, 2016 08:02 AM

Updated April 09, 2015 22:02 PM

Updated August 24, 2018 15:06 PM

Updated December 27, 2018 07:06 AM

Updated June 11, 2015 18:02 PM