feat: refs #6500 procRefactor8 #2131

Merged
robert merged 28 commits from 6500-procRefactor8 into dev 2024-04-17 11:32:54 +00:00
2 changed files with 14 additions and 13 deletions
Showing only changes of commit 2c0c346a7b - Show all commits

View File

@ -16,31 +16,32 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS tCreditClients;
CREATE TEMPORARY TABLE tCreditClients
SELECT clientFk, IF (credit > recovery ,credit - recovery,0) newCredit
SELECT clientFk, IF(credit > recovery, credit - recovery, 0) newCredit
robert marked this conversation as resolved Outdated

Espacios: SELECT clientFk, IF (credit > recovery, credit - recovery, 0) newCredit

Espacios: SELECT clientFk, IF (credit > recovery, credit - recovery, 0) newCredit
FROM (
robert marked this conversation as resolved Outdated

tabulación FROM

tabulación FROM
SELECT r.clientFk,
r.amount recovery,
timestampadd(DAY, r.period, sub2.created) deadLine,
(sub2.created + INTERVAL r.period DAY) deadLine,
robert marked this conversation as resolved Outdated

INTERVAL

INTERVAL
sub2.amount credit
FROM recovery r
JOIN (
SELECT clientFk, amount , created
FROM (
SELECT * FROM clientCredit
ORDER BY created DESC
LIMIT 10000000000000000000
) sub
SELECT clientFk, amount, created
FROM (
SELECT clientFk, amount, created
robert marked this conversation as resolved Outdated

Especificar campos, eliminar *

Especificar campos, eliminar *
FROM clientCredit
ORDER BY created DESC
LIMIT 10000000000000000000
) sub
GROUP BY clientFk
) sub2 ON sub2.clientFk = r.clientFk
WHERE r.finished IS NULL OR r.finished >= util.VN_CURDATE()
GROUP BY r.clientFk
robert marked this conversation as resolved Outdated

tabulación HAVING

tabulación HAVING
HAVING deadLine <= util.VN_CURDATE()
HAVING deadLine <= util.VN_CURDATE()
) sub3
WHERE credit > 0;
UPDATE client c
robert marked this conversation as resolved Outdated

tabulación JOIN y SET

tabulación JOIN y SET
JOIN tCreditClients cc ON cc.clientFk = c.id
SET c.credit = newCredit;
JOIN tCreditClients cc ON cc.clientFk = c.id
SET c.credit = newCredit;
DROP TEMPORARY TABLE tCreditClients;
COMMIT;

View File

@ -1,4 +1,4 @@
-- Place your SQL code here
UPDATE bs.nightTask SET `schema`='vn' WHERE id=22;
UPDATE bs.nightTask SET `schema`='vn' WHERE `procedure`='raidUpdate';
robert marked this conversation as resolved Outdated

Utilizar el nombre del procedure y no la posición

Utilizar el nombre del procedure y no la posición
UPDATE bs.nightTask SET `schema`='vn',`procedure`='creditRecovery' WHERE id=30;
UPDATE bs.nightTask SET `schema`='vn',`procedure`='creditRecovery' WHERE `procedure` ='recobro_credito';
robert marked this conversation as resolved Outdated

Utilizar el nombre del procedure y no la posición

Utilizar el nombre del procedure y no la posición