SELECT c.customer_code, c.customer_name, c.customer_category_id from 0p4_customer c left join 0p4_customer_category cc on cc.id=c.customer_category_id
where c.customer_category_id is not null and cc.id is null;


UPDATE `0p4_customer` SET `customer_term_id` = 2  WHERE `customer_term_id` = 1 ;
UPDATE `0p4_customer` SET `customer_term_id` = 3  WHERE `customer_term_id` = 2 ;
UPDATE `0p4_customer` SET `customer_term_id` = 4  WHERE `customer_term_id` = 3 ;
UPDATE `0p4_customer` SET `customer_term_id` = 6 WHERE `customer_term_id` = 4 ;

UPDATE `0p4_customer` SET `customer_term_id` = 6 WHERE `customer_term_id` = 4 ;


UPDATE `0p4_customer` SET `customer_category_id` = 12 WHERE `customer_category_id` = 8 ;


select c.customer_code,pt.name from 0p4_customer c left join 0p4_payment_terms pt on pt.payment_terms_id=c.customer_term_id
where c.customer_term_id is not null and c.isDeleted=0


SELECT g.id as 'group_id',d.id as "group_detail_id" ,g.name, d.item_code, u.uom_name,d.pack_size,d.moq,d.group_price,d.description  FROM `0p4_customer_group_pricing_detail` d
left join `0p4_customer_group_pricing` g on g.id=d.customer_group_pricing_id
left join 0p4_uom u on u.uom_id=d.uom_id
where g.id=9
