That Moment Your VIEW Refuses to Compile You're refactoring a reporting query. It's gnarly — three layers of aggregation, a couple of LEFT JOINs, the works. You wrap it in a subquery in the FROM clause, run it, get the right numbers. Nice. Now you decide to encapsulate the whole thing in a VIEW so the analytics folks don't have to copy-paste it. You run CREATE VIEW . MySQL throws this in your face: ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause Enter fullscreen mode Exit fullscreen mode If you've worked with MySQL long enough, this error has shown up at least once. It's the symptom of one of MySQL's oldest documented limitations — tracked as Bug #11472 — and developers have been finding workarounds for it for two decades. I want to walk through why this happens, how to work around it cleanly with the tools that exist today, and what the reportedly-landed fix might change for your codebase.…