python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
CTE Fast To Select from but Slow to Insert from
I've got a CTE that does a lot of hard work over tens of thousands of records.
If I just run the select below which uses the CTE it comes back in less than a second.
However if I add the insert line a...
fosbie
Votes: 0
Answers: 1
how to store cte and use it inside another cte in sql server
im trying to do cohort analysis using SQL server
i was looking at this online
`-- (user_id, cohort_month), each
with cohort_items as (
select
date_trunc('month', U.timestamp)::date as cohort_mo...
Kaokor
Votes: 0
Answers: 2
Improve query to get most games won
Here is the problem as follows:
team
season
games_won
San Francisco Giants
2010
92
San Francisco Giants
2011
86
San Francisco Giants
2012
94
San Francisco Giants
2013
76
San Francisco ...
Alexis Moreno
Votes: 0
Answers: 1
Unable to left join within a SQL query containing CTEs
I need to combine the results from two different CTEs into a single table. Hence, I have written the following SQL query wherein I attempted to create a left join on two different fields (patient_id, ...
veg2020
Votes: 0
Answers: 1