I'm facing a problem, I have two sql selects
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')
That brings me the values of the year 2018 and I have this:
select*fromweb.demonstrativo_processadoswherenroempresa=1anddatabetweento_date('2017/01/01','yyyy/mm/dd')andto_date('2017/12/31','yyyy/mm/dd')
Whichreturnsthevaluesfor2017.
Iwouldlikethetwocolumnstocomeasananswer,soIneedtointegratethe2selects.
AsI'musingphpandgooglechartstogeneratecharts,itwouldmakethejobaloteasierforme.graphicIwanttodo
Thankyou
WHILEMYPHP
<html><head><scripttype="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script><scripttype="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>