Advertisement
yesamarcos

Como fazer o relacionamento funcionar?

Sep 27th, 2017
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.29 KB | None | 0 0
  1. SELECT `ORCD_VLR` as SOMATORIA_ORCAM, SUM(LANC_VALOR) as SOMATORIA_VALOR
  2. FROM (`orcamento_detalhes` o)
  3. JOIN `lancamento` l ON `l`.`LANC_NAT_ID` = `o`.`ORCD_NAT_ID`
  4. WHERE `ORCD_NAT_ID` =  1
  5. AND `LANC_NAT_ID` =  1
  6. GROUP BY `ORCD_NAT_ID`, `ORCD_MES`
  7. ORDER BY `ORCD_NAT_ID` ASC, `ORCD_MES` ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement