feat: refs #7010 added subquery to avoid using group by in sql
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
b547858820
commit
b55db4bdc0
|
@ -229,7 +229,7 @@ module.exports = Self => {
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
|
||||
(INDEX (id))
|
||||
ENGINE = InnoDB
|
||||
SELECT t.id,
|
||||
SELECT DISTINCT t.id,
|
||||
t.shipped,
|
||||
CAST(DATE(t.shipped) AS CHAR) shippedDate,
|
||||
HOUR(t.shipped) shippedHour,
|
||||
|
@ -261,7 +261,11 @@ module.exports = Self => {
|
|||
z.id zoneFk,
|
||||
CAST(z.hour AS CHAR) hour,
|
||||
a.nickname addressNickname,
|
||||
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk SEPARATOR ',') packing
|
||||
(SELECT GROUP_CONCAT(DISTINCT i2.itemPackingTypeFk ORDER BY i2.itemPackingTypeFk SEPARATOR ',')
|
||||
FROM sale s2
|
||||
JOIN item i2 ON i2.id = s2.itemFk
|
||||
WHERE s2.ticketFk = t.id
|
||||
) AS packing
|
||||
FROM ticket t
|
||||
LEFT JOIN invoiceOut io ON t.refFk = io.ref
|
||||
LEFT JOIN zone z ON z.id = t.zoneFk
|
||||
|
@ -275,8 +279,6 @@ module.exports = Self => {
|
|||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||
LEFT JOIN account.user u ON u.id = wk.id
|
||||
LEFT JOIN route r ON r.id = t.routeFk
|
||||
LEFT JOIN sale s ON t.id = s.ticketFk
|
||||
LEFT JOIN item i ON i.id = s.itemFk
|
||||
`);
|
||||
|
||||
if (args.orderFk) {
|
||||
|
@ -295,9 +297,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
stmt.merge({
|
||||
sql: `GROUP BY t.id`
|
||||
});
|
||||
|
||||
stmts.push(stmt);
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
|
|
Loading…
Reference in New Issue