This commit is contained in:
parent
08cf849b7a
commit
a42562b0ca
|
@ -55,8 +55,8 @@ BEGIN
|
|||
|
||||
-- Recobros
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
||||
DROP TEMPORARY TABLE IF EXISTS tTicket_list;
|
||||
CREATE TEMPORARY TABLE tTicket_list
|
||||
(PRIMARY KEY (Id_Ticket))
|
||||
SELECT DISTINCT t.id Id_Ticket
|
||||
FROM vn.saleComponent sc
|
||||
|
@ -74,7 +74,7 @@ BEGIN
|
|||
|
||||
DELETE g.*
|
||||
FROM vn.greuge g
|
||||
JOIN tmp.ticket_list t ON g.ticketFk = t.Id_Ticket
|
||||
JOIN tTicket_list t ON g.ticketFk = t.Id_Ticket
|
||||
WHERE g.greugeTypeFk = 2;
|
||||
|
||||
INSERT INTO vn.greuge(clientFk, description, amount,shipped,
|
||||
|
@ -87,7 +87,7 @@ BEGIN
|
|||
,tt.Id_Ticket
|
||||
FROM vn.sale s
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
JOIN tmp.ticket_list tt ON tt.Id_Ticket = t.id
|
||||
JOIN tTicket_list tt ON tt.Id_Ticket = t.id
|
||||
JOIN vn.saleComponent sc
|
||||
ON sc.saleFk = s.id AND sc.componentFk = 17
|
||||
GROUP BY t.id
|
||||
|
@ -95,7 +95,7 @@ BEGIN
|
|||
|
||||
UPDATE vn.saleComponent sc
|
||||
JOIN vn.sale s ON s.id = sc.saleFk
|
||||
JOIN tmp.ticket_list tt ON tt.Id_Ticket = s.ticketFk
|
||||
JOIN tTicket_list tt ON tt.Id_Ticket = s.ticketFk
|
||||
SET sc.isGreuge = 1
|
||||
WHERE sc.componentFk = 17;
|
||||
|
||||
|
@ -164,6 +164,6 @@ BEGIN
|
|||
SET cr.recobro = sub.recobro
|
||||
WHERE Id_Cliente IN ( 5189,8942);
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket_list;
|
||||
DROP TEMPORARY TABLE tTicket_list;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue