mirror of https://github.com/jeecgboot/jeecg-boot
Update sku_weight_discount view for performance improvement
parent
722908f2d4
commit
4043733136
|
@ -1,7 +1,9 @@
|
||||||
CREATE OR REPLACE VIEW sku_weight_discount_service_fees AS
|
CREATE OR REPLACE VIEW sku_weight_discount_service_fees AS
|
||||||
SELECT s.id,
|
SELECT s.id,
|
||||||
s.erp_code,
|
s.erp_code,
|
||||||
(SELECT sw.weight FROM sku_weight sw WHERE sw.sku_id = s.id ORDER BY effective_date DESC LIMIT 1) as weight,
|
sw.weight,
|
||||||
s.shipping_discount,
|
s.shipping_discount,
|
||||||
s.service_fee
|
s.service_fee
|
||||||
FROM sku s
|
FROM sku_weight sw inner join (select sku_id, max(effective_date) max_date from sku_weight group by sku_id) sw2
|
||||||
|
on sw.sku_id = sw2.sku_id and sw.effective_date = sw2.max_date
|
||||||
|
join sku s on sw.sku_id = s.id
|
Loading…
Reference in New Issue