Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 4, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 4, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 4, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 4, 2025

      I like SteelSeries’ tiniest high performance gaming keyboard, but it’s not the only great magnetic option

      May 4, 2025

      Motion Highlights #5

      May 4, 2025

      How to make LinkedIn work for you: 3 things you must get right

      May 4, 2025

      My top gaming laptop of 2024 defended its crown with a redesign, but lost one of my favorite features

      May 3, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Brisa 0.2.12 – Near 0.3 🔜

      May 3, 2025
      Recent

      Brisa 0.2.12 – Near 0.3 🔜

      May 3, 2025

      Essential Git Command Reference: The Core Operations Every Developer Needs

      May 3, 2025

      nativephp/electron

      May 3, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      I like SteelSeries’ tiniest high performance gaming keyboard, but it’s not the only great magnetic option

      May 4, 2025
      Recent

      I like SteelSeries’ tiniest high performance gaming keyboard, but it’s not the only great magnetic option

      May 4, 2025

      Microsoft says it accidentally broke Windows 10 Start menu, taskbar recent files feature

      May 4, 2025

      OpenCPN is a ship-borne GUI navigation application

      May 4, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»The Sales Target

    The Sales Target

    March 4, 2025

    The end of the quarter was approaching, and dark clouds were gathering in the C-suite. While they were trying to be tight lipped about it, the scuttlebutt was flowing freely. Initech had missed major sales targets, and not just by a few percentage points, but by an order of magnitude.

    Heads were going to roll.

    Except there was a problem: the master report that had kicked off this tizzy didn’t seem to align with the department specific reports. For the C-suite, it was that report that was the document of record; they had been using it for years, and had great confidence in it. But something was wrong.

    Enter Jeff. Jeff had been hired to migrate their reports to a new system, and while this particular report had not yet been migrated, Jeff at least had familiarity, and was capable of answering the question: “what was going on?” Were the sales really that far off, and was everyone going to lose their jobs? Or could it possibly be that this ancient and well used report might be wrong?

    The core of the query was basically a series of subqueries. Each subquery followed this basic pattern:

    SELECT SUM(complex_subquery_A) as subtotal FROM complex_subquery_B
    

    None of this was particularly readable, mind you, and it took some digging just to get the shape of the individual queries understood. But none of the individual queries were the problem; it was the way they got stitched together:

    SELECT SUM(subtotal)
    FROM
    (SELECT SUM(complex_subquery_A) as subtotal FROM complex_subquery_B
    UNION
    SELECT SUM(complex_subquery_C) as subtotal FROM complex_subquery_D
    UNION
    SELECT SUM(complex_subquery_E) as subtotal FROM complex_subquery_F);
    

    The full query was filled with a longer chain of unions, but it was easy to understand what went wrong, and demonstrate it to management.

    The UNION operator does a set union- which means if there are any duplicate values, only one gets included in the output. So if “Department A” and “Department C” both have $1M in sales for the quarter, the total will just be $1M- not the expected $2M.

    The correct version of the query would use UNION ALL, which preserves duplicates.

    What stunned Jeff was that this report was old enough to be basically an antique, and this was the kind of business that would burn an entire forest down to find out why a single invoice was off by $0.15. It was sheer luck that this hadn’t caused an explosion before- or maybe in the past it had, and someone had just written it off as a “minor glitch”?

    Unfortunately for Jeff, because the report was so important it required a huge number of approvals before the “UNION ALL” change could be deployed, which meant he was called upon to manually run a “test” version of the report containing the fix every time a C-suite executive wanted one, until the end of the following quarter, when he could finally integrate the fix.

    [Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleFirefox 136 Released with Vertical Tabs, New Sidebar + More
    Next Article Creating Stylized Water Effects with React Three Fiber

    Related Posts

    News & Updates

    I like SteelSeries’ tiniest high performance gaming keyboard, but it’s not the only great magnetic option

    May 4, 2025
    News & Updates

    Motion Highlights #5

    May 4, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    5 quick ways Apple’s AI tools can fine-tune your writing on the fly

    News & Updates

    Il tasto Copilot delle nuove tastiere verrà supportato dal kernel Linux, ma ci sono diverse questioni di sicurezza da considerare

    Linux

    Android’s New Identity Check Feature Locks Device Settings Outside Trusted Locations

    Development

    This AI Paper Proposes NLRL: A Natural Language-Based Paradigm for Enhancing Reinforcement Learning Efficiency and Interpretability

    Development

    Highlights

    Artificial Intelligence

    Redact Personal Identifiable Information (PII) from audio with Node.js

    June 12, 2024

    Personally Identifiable Information, or PII, is personal information about an individual that can be used…

    The AI Fix #40: ChatGPT saved my life, and making evil AIs by accident

    March 16, 2025

    UniTaskerPro

    April 30, 2025

    Even though Xbox is losing the console war, ironically, it is the console war that makes it superior, gamers agree

    April 9, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.