I am in an advanced stage of my phd, finishing next year. I have 2-first author publications in which I used data from my group. My research group has different datasets stored in MySQL
server, in which each researcher accessed their relevant dataset.
In my 2 previous publications, I exported my dataset into a csv
file and worked with it. During this data export, I had to perform a couple of table join operations, involving filtered data in a kind of "summary" table, joining it with a table containing original raw data.
Last week, I was working on my third review paper, and I needed to get some statistics from the MySQL
server, when I discovered that the dataset I used in my previous research was actually incorrect. Incorrect in the sense that I had an error in my data filter SQL query (used to export it), therefore the exported dataset was incomplete, kind of a "subset" of the actual data.
All my conclusions in previous work were drawn from this incorrect data. I am in panic, and don't know what to do. I am not sure what the reactions of my supervisor would be, if I explain this problem to him. He is such a person that expects "near perfect" from his students.
I am now sure how this will affect my PhD. The years and efforts invested are likely in vain. What is the best course of action?