Oh ya… select fact.store_tag,fact.period,fact.upc upcid, case when mkt_tag = 4480 then market.description else '' end retailmarket, case when mkt_tag = 100 then market.description else '' end compmarket, case when mkt_tag = 4480 then dollars else 0 end base_dollars, case when mkt_tag = 100 then dollars else 0 end ref_dollars, case when mkt_tag = 4480 then units else 0 end base_units, case when mkt_tag = 100 then units else 0 end ref_units, case when mkt_tag = 100 then acv else null end avg_acv, case when mkt_tag = 4480 then b_dollars else 0 end base_base_dollars, case when mkt_tag = 100 then b_dollars else 0 end ref_base_dollars, case when mkt_tag = 4480 then b_units else 0 end base_base_units, case when mkt_tag = 100 then b_units else 0 end ref_base_units, product.lvl,product.upc, product.description as description, product.category,product.category_tag, product.subcategory, product.company,product.brand, market.mkt_tag as mkt_tag, period.period, period.orderno from sg_dm_b.t_week_f fact, sg_dm_b.nb_products product, sg_dm_b.nb_markets market, sg_dm_b.nb_periods period where (product.product_key = fact.upc) and (market.mkt_tag = fact.store_tag) and (period.period = fact.period) and fact.store_tag in(100,4480) and product.lvl = 'UPC' and product.category_tag = 'GRBYFD' and period.orderno between 1446 and 1450; — change to period.orderno between 1447 and 1450 gives the none material version of the plan. On Aug 27, 2014, at 1:18 PM, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote: On 08/27/2014 11:02 AM, Dennis wrote:Hi, I am having bad luck with a query that should return zero rows but |