Find near duplicates in mysql table based on specific criteria, merge data (or update one row with data from other row, delete 2nd row)
I need to work with data that will be used to produce a printed class schedule. For bureaucratic reasons, a class with a lab and a lecture component is split into 2 separate class rows, one for the lab, and one for the lecture. But it is essentially the same class. So for the purposes of display, I want to merge the two rows, either in the mysql database itself, or when selecting the data for the display/download query. The criteria is this: The Lecture Row and the Lab row have the same section number, except that the Lab row has an X at the end of the Section, and, the Lab ClassNbr is always 1 greater than the Lecture class number. The Lab Start time is always one minute after the Lecture end time. So for display purposes I want to take the Class End time (MtgEnd) from the Lab row, suppress all the other data in the row, and merge the Class End Time (MtgEnd) to the Class End time for the Lecture row. I have attached a sample bit of data showing the before and after pictures.
Not all of the rows have a lab/lecture pairing, so those should be left alone.
Thanks for any help you can provide.
Hope this is clear. If you have any questions, please let me know. ee2.xlsx