How do I use the result of a sub query multiple times? Is there any way to name that result and use it somewhere else? I know about with xyz as ... and that doesn't seem to work?
I found this and would like something more specific?
Sample of broken code:
with g_surf as (select surface_area from countries where name like 'Germa%')
select abs(surface_area - g_surf) from countries;
working code that uses the entire sub query:
select abs(surface_area - (select surface_area from
countries where name like 'Germa%')) from countries;