Skip to content

Tag: common-table-expression

WITH queries with INSERT in MySQL

I’m trying to do something that I’m almost positive works in Postgresql: In other words, I want to grab the “something” row to be used for a bunch of new rows in “somwhere”. Each new entry should have a reference (like foreign key value) back to the same “something&#8…

cte FULL OUTER JOIN MYSQL

I have this table(called trial): ‘year1’ refers to values in Column ‘val1’, ‘year2’ to values in Column ‘val2’. I want to get totals of all values grouped by year. So I would like to see a result like: I set up a common table expression(cte) using a self join to…