SELECT sudovlad,SUM(gruz_pass) as summa ,EXTRACT(YEAR FROM data_vih_p_ot) as year FROM ships WHERE EXTRACT(YEAR FROM data_vih_p_ot) = 2017 GROUP BY sudovlad
SELECT sudovlad,SUM(gruz_pass) as summa ,EXTRACT(YEAR FROM data_vih_p_ot) as year FROM ships WHERE EXTRACT(YEAR FROM data_vih_p_ot) = 2018 GROUP BY sudovlad
SELECT
ships.sudovlad,
s1.summa,
s1.year as years,
((s2.summa - s1.summa) / s1.summa * 100) AS percent,
s2.summa as summa2,
s2.year AS years2
FROM ships
LEFT JOIN (
SELECT sudovlad,SUM(gruz_pass) as summa ,EXTRACT(YEAR FROM data_vih_p_ot) as year
FROM ships WHERE EXTRACT(YEAR FROM data_vih_p_ot) = 2017 GROUP BY sudovlad) as s1
ON s1.sudovlad = ships.sudovlad
LEFT JOIN (
SELECT sudovlad,SUM(gruz_pass) as summa ,EXTRACT(YEAR FROM data_vih_p_ot) as year
FROM ships WHERE EXTRACT(YEAR FROM data_vih_p_ot) = 2018 GROUP BY sudovlad) as s2
ON s2.sudovlad = ships.sudovlad
WHERE ships.sudovlad IN ('Русфлот, ООО', 'АрктикТранс ОИЛ, ООО','pere')
GROUP BY sudovlad
SELECT
ships.sudovlad,
s1.gruz_pass as summa,
EXTRACT(YEAR FROM s1.data_vih_p_ot) as years,
((s2.gruz_pass - s1.gruz_pass) / s1.gruz_pass * 100) AS percent,
s2.gruz_pass as summa2,
EXTRACT(YEAR FROM s2.data_vih_p_ot) AS years2
FROM ships
LEFT JOIN ships as s1
ON ships.sudovlad = s1.sudovlad AND EXTRACT(YEAR FROM s1.data_vih_p_ot)=2017 AND s1.sudovlad IN ('Русфлот, ООО', 'АрктикТранс ОИЛ, ООО','pere')
LEFT JOIN ships as s2
ON ships.sudovlad = s2.sudovlad AND EXTRACT(YEAR FROM s2.data_vih_p_ot)=2018 AND s2.sudovlad IN ('Русфлот, ООО', 'АрктикТранс ОИЛ, ООО','pere')
GROUP BY sudovlad
{"title":"article","content":"la la la la"}
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
obj = JSON.parse(this.responseText);
document.getElementById('title').innerHTML = obj.title;
document.getElementById('content').innerHTML = obj.content;
}
};
xhttp.open("GET", "site.ru/api.php/post/3", true);
xhttp.send();
</script>
jsonObject = JSON.parse(this.responseText);
document.getElementById('output').innerHTML = JSON.stringify(jsonObject, undefined, 3);
Я бы например настроил бы субдомен deploy.site.test так чтобы при обращении к нему отрабатывал скрипт deploy.php. На nginx я сделаю это за минуты, вот на apache сложнее наверно