检查一下数据,ordered_items_bak.[buying price]和ordered_items_bak.[public price] 允许空吗?
没用Outer join 不应该有null

解决方案 »

  1.   

    语句太晕。
    贴出表结构吧整理了一下语句花了3分钟。。先把语句给你,自己好好看下逻辑有没有错:
     select brand,linename,productref,description,ordered_items_bak.[buying price],ordered_items_bak.[public price]
     
     from   orders,ordered_items_bak ,[product information],item_specification
     
      where orders.[order ref] = ordered_items_bak.[order ref] and
     
      [product information].[productref] = ordered_items_bak.[product reference] and
     
      ordered_items_bak.[product reference] = item_specification.[product reference] and 
      ordered_items_bak.[order ref] = item_specification.[order ref]  and
     
      item_specification.[order ref] = 'Sp0101123186' 
          
    group by 
        [orders].brand,
        [product information].linename,
        [product information].productref,
        [product information].description,
        [public price],[public price2],
        [public price3],[buying price],
        ordered_items_bak.[order ref]
    order by 
         orders.brand,[product information].linename,[product information].productref