Skip to content

Instantly share code, notes, and snippets.

@dario61081
Created July 29, 2018 21:06
Show Gist options
  • Save dario61081/779ad07f865b24c6fe29b05002d90821 to your computer and use it in GitHub Desktop.
Save dario61081/779ad07f865b24c6fe29b05002d90821 to your computer and use it in GitHub Desktop.
Seleccionando items de una tabla contra una lista subselect. (firebird)
-- seleccionando items de una tabla contra una lista subselect (firebird).
select p.categoria, t.sub_categoria,0 monto
from pagos p, (select distinct pp.sub_categoria from pagos pp) t
group by 1,2
-- dataset --
-- categoria: 7,8,9
-- sub categoria: a,b,c,d,e
-- results --
CATEGORIA SUB_CATEGORIA MONTO
7 a 0
7 b 0
7 c 0
7 d 0
7 e 0
8 a 0
8 b 0
8 c 0
8 d 0
8 e 0
9 a 0
9 b 0
9 c 0
9 d 0
9 e 0
-- origen --
select distinct p.categoria, p.sub_categoria,0 monto
from pagos p
group by 1,2
-- results --
CATEGORIA SUB_CATEGORIA MONTO
7 a 0
8 b 0
8 c 0
9 a 0
9 d 0
9 e 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment