fix: restore IS NULL OR * to cover both conventions; keep direct dd.discount without GROUP BY
This commit is contained in:
parent
c39e54f379
commit
51a1616b9f
@ -830,7 +830,7 @@ async def get_marketing_discount_products(request):
|
|||||||
SELECT dd.productid, dd.discount
|
SELECT dd.productid, dd.discount
|
||||||
FROM discount_detail dd
|
FROM discount_detail dd
|
||||||
JOIN discount d ON dd.discountid = d.id
|
JOIN discount d ON dd.discountid = d.id
|
||||||
WHERE d.resellerid = ${org_id}$ AND d.customerid = '*'
|
WHERE d.resellerid = ${org_id}$ AND (d.customerid IS NULL OR d.customerid = '*')
|
||||||
) base ON base.productid = p.id
|
) base ON base.productid = p.id
|
||||||
LEFT JOIN discount_detail mkt ON mkt.productid = p.id AND mkt.discountid = ${discountid}$
|
LEFT JOIN discount_detail mkt ON mkt.productid = p.id AND mkt.discountid = ${discountid}$
|
||||||
WHERE p.org_id = ${org_id}$ AND p.status = '1'
|
WHERE p.org_id = ${org_id}$ AND p.status = '1'
|
||||||
|
|||||||
@ -32,7 +32,7 @@ LEFT JOIN (
|
|||||||
SELECT dd.productid, dd.discount
|
SELECT dd.productid, dd.discount
|
||||||
FROM discount_detail dd
|
FROM discount_detail dd
|
||||||
JOIN discount d ON dd.discountid = d.id
|
JOIN discount d ON dd.discountid = d.id
|
||||||
WHERE d.resellerid = ${org_id}$ AND d.customerid = '*'
|
WHERE d.resellerid = ${org_id}$ AND (d.customerid IS NULL OR d.customerid = '*')
|
||||||
) base ON base.productid = p.id
|
) base ON base.productid = p.id
|
||||||
LEFT JOIN discount_detail mkt ON mkt.productid = p.id AND mkt.discountid = ${discountid}$
|
LEFT JOIN discount_detail mkt ON mkt.productid = p.id AND mkt.discountid = ${discountid}$
|
||||||
WHERE p.org_id = ${org_id}$ AND p.status = '1'
|
WHERE p.org_id = ${org_id}$ AND p.status = '1'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user