return count of inserted rows
This commit is contained in:
parent
bceac1d195
commit
3b3a2f7b39
@ -152,6 +152,7 @@ SELECT
|
|||||||
FROM
|
FROM
|
||||||
baseline o$$||E'\n'||_perd_joins||$$
|
baseline o$$||E'\n'||_perd_joins||$$
|
||||||
)
|
)
|
||||||
|
,ins AS (
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
fc.live
|
fc.live
|
||||||
SELECT
|
SELECT
|
||||||
@ -160,7 +161,10 @@ FROM
|
|||||||
incr i
|
incr i
|
||||||
WHERE
|
WHERE
|
||||||
i.$$||_order_date||$$ >= 'app_first_forecast_date'::date$$||$$
|
i.$$||_order_date||$$ >= 'app_first_forecast_date'::date$$||$$
|
||||||
OR i.$$||_ship_date||$$ >= 'app_first_forecast_date'::date$$
|
OR i.$$||_ship_date||$$ >= 'app_first_forecast_date'::date$$||$$
|
||||||
|
RETURNING *
|
||||||
|
)
|
||||||
|
SELECT COUNT(*) num_rows FROM ins$$
|
||||||
--any orders in the forecast period, or any sales in the forecast period (from open orders)
|
--any orders in the forecast period, or any sales in the forecast period (from open orders)
|
||||||
INTO
|
INTO
|
||||||
_baseline;
|
_baseline;
|
||||||
|
4
index.js
4
index.js
@ -87,8 +87,8 @@ server.get('/baseline', bodyParser.json(), function(req, res) {
|
|||||||
//execute the sql and send the result
|
//execute the sql and send the result
|
||||||
args.push(req.body.app_baseline_from_date);
|
args.push(req.body.app_baseline_from_date);
|
||||||
console.log(sql);
|
console.log(sql);
|
||||||
res.send(sql);
|
//res.send(sql);
|
||||||
//Postgres.FirstRow(sql, [], res)
|
Postgres.FirstRow(sql, [], res)
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user