Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.
How can I modify the above query in such a way that , it checks for split column, if the split is not <> 100 then it separates vendor_code separately under 2 columns vendor1_code and vendor2_code. If the split = 100 then generates vendor1_code
select dv.VENDOR_CODE,dv.VENDOR_NAME, d.THISDATE, sum(po.QUANTITY) , rfp.VENDOR_SHARE_PERCENT as SPLIT from fact_po_lines po inner join dim_product p on po.dim_product_id = p.dim_product_id and p.product_sku = '02128087' INNER JOIN DIM_DATE d ON po.ORDERED_DATE_ID = d.DIM_DATE_ID INNER JOIN FACT_PA_ITEM pai ON po.DIM_PRODUCT_ID = pai.DIM_PRODUCT_ID and po.DIM_VENDOR_ID = pai.DIM_VENDOR_ID INNER JOIN DIM_VENDOR dv ON po.DIM_VENDOR_ID = dv.DIM_VENDOR_ID INNER JOIN DIM_DATE deff ON pai.DIM_DATE_EFFECTIVE_ID = deff.DIM_DATE_ID INNER JOIN DIM_DATE dexp ON pai.DIM_DATE_EXPIRATION_ID = dexp.DIM_DATE_ID INNER JOIN DIM_VENDOR dv ON pai.DIM_VENDOR_ID = dv.DIM_VENDOR_ID INNER JOIN DIM_PRODUCT p ON pai.DIM_PRODUCT_ID = p.DIM_PRODUCT_ID INNER JOIN FACT_RFP_PRODUCT rfp ON pai.SOURCE_RFP_ID = rfp.SOURCE_RFP_ID and pai.DIM_PRODUCT_ID = rfp.DIM_PRODUCT_ID and pai.DIM_DATE_EFFECTIVE_ID = rfp.DIM_DATE_CREATE_ID where d.THISDATE = '19-DEC-14'-- and d.thisdate < '31-DEC-15' and d.thisdate between deff.THISDATE and dexp.THISDATE group by dv.vendor_code, dv.vendor_name, d.thisdate, rfp.vendor_share_percent order by d.thisdate, dv.vendor_code;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.