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

The equivalent of CTE in MySQL from Microsoft SQL

Updated November 15, 2016 08:02 AM

getting innodb buffer usage

Updated August 24, 2018 15:06 PM