Unir 2 SELECTS Oracle e como resultado 2 colunas com valores diferentes
Estou enfrentando um problema, eu possuo dois selects sql
select *
from web.demonstrativo_processados
where nroempresa = 1
and data between to_date('2018/01/01' , 'yyyy/mm/dd')
and to_date('2018/12/31' , 'yyyy/mm/dd')
que me trás os valores do ano de 2018 e tenho este:
[/applications/core/interface/imageproxy/imageproxy.php?img=https://i.stack.imgur.com/6WtXQ.png&key=a127732394a53c4b9927b0e553c2c831f804edcf069222db2e4be86b0f41b481" style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;" data-imageproxy-source="https://i.stack.imgur.com/6WtXQ.png" />](https://i.stack.imgur.com/6WtXQ.png)
select *from web.demonstrativo_processados
where nroempresa = 1
and data between to_date('2017/01/01' , 'yyyy/mm/dd')
and to_date('2017/12/31' , 'yyyy/mm/dd')
Que retorna os valores de 2017. [/applications/core/interface/imageproxy/imageproxy.php?img=https://i.stack.imgur.com/cNvmz.png&key=dcd681c2f7dc3a3edf955395c27fa225de7fd14bb47ceeb3b8d29ca4f32e1461" style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;" data-imageproxy-source="https://i.stack.imgur.com/cNvmz.png" />](https://i.stack.imgur.com/cNvmz.png)
Eu gostaria que viesse como resposta estas duas colunas que estão em azul, por isso preciso integrar os 2 selects.
Como estou usando o php e o google charts para gerar gráficos, iria me facilitar muito o trabalho. gráfico que pretendo fazer
[/applications/core/interface/imageproxy/imageproxy.php?img=https://i.stack.imgur.com/ZYGHF.png&key=409c20eb073b44f0a0cce0a582d21befe364a116b096126137f1ac567fa087f2" style="border:0px;font-size:15px;padding:0px;vertical-align:baseline;" data-imageproxy-source="https://i.stack.imgur.com/ZYGHF.png" />](https://i.stack.imgur.com/ZYGHF.png)
o while que uso para pegar os valores
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Mês', '2017', '2018'],
<?php
include ("./conexao_local.php");
$sql = "select * from web.demonstrativo_processados where nroempresa = 1 and data between to_date('2017/01/01' , 'yyyy/mm/dd') and to_date('2017/12/31' , 'yyyy/mm/dd')";
$stmt = oci_parse($conexao, $sql);
oci_execute($stmt);
while (($array = oci_fetch_array($stmt, OCI_BOTH)) != false) {
$valorvenda = $array["VLRVENDA"];
$valorvenda1 = str_replace(",",".", $valorvenda);
?>
['Mês 2017', <?php echo $valorvenda1 ?>,400],
<?php } ?>
]);
var options = {
title: 'Company Performance',
hAxis: {title: 'Year', titleTextStyle: {color: '#333'}},
vAxis: {minValue: 0}
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div_1'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div_1" style="width: 100%; height: 500px;"></div>
</body>
</html>
Obrigado...Discussão (4)
Carregando comentários...