15+ years into this writing software thing and I just realized the HAVING keyword exists in SQL. Mentioning for benefit of everyone else creating temporary tables for no reason. http://www.postgresqltutorial.com/postgresql-having/ …
-
-
This Tweet is unavailable.
-
Yeah, it does. (Oh the joys of writing SQL over twitter for a hypothetical schema.)
End of conversation
-
-
-
and then people blame performance on things like rails
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Having still probably best to use, but breaking it up into a CTE when it comes to SQL is still a great practice that is very easy for those that don’t use SQL every day to follow
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
omg Why is this still happening to me
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
We use a lot of outer joins with HAVING x = 0 - and these work on the small scale for “haven’t done x yet” queries. At medium scale, temp tables! (And don’t work fast enough at large scale at all) Still a useful technique to know
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Patrick noo You forgot to time limit your ltv to make it comparable over cohorts. sum(case when extract('days' from http://order.date _created - customer.first_order) <= 30 then order.invoice_value else null end) as ltv
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.