troubleshooting Question

Find near duplicates in mysql table based on specific criteria, merge data (or update one row with data from other row, delete 2nd row)

Avatar of aberns
abernsFlag for United States of America asked on
DatabasesPHPSQL
16 Comments1 Solution437 ViewsLast Modified:
Hello,

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
ASKER CERTIFIED SOLUTION
Mathiyazhagan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 16 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros