Today I overheard a couple coworkers on an unrelated business area talking about a SQL query they were using for two years that turns out is not quite correct. They were talking about what specific aspects of the query needed to be fixed in order to get the correct result.
Let's say someone at your company relies on some metric or KPI to make a business decision. If you were the one that got assigned how to get that metric, or are the one that has been used such method for a while, how should you proceed moving forwards?
Obviously fixing it and improving the KPI or metric would be key, but I am more interested in how to report it in order to not get fired (should you be fired for this type of thing? I honestly do not know), or how to avoid this having implications in future salary adjustments or promotions, if it can be avoided.
Would it be assumed as a cost of doing somewhat complex business or could it be interpreted as a sign of incompetence? For context I (and my coworkers) work in areas where it is not unusual to program dozens/hundreds of different querys, some ad hoc, some with more thought put behind, in order to satisfy other areas of the business needs.