如下SQL:
select nx,nx as nx1,ggdm,gg,MD, GL,CPB,count(*) as sl,bz,bz as je,'0' as ls into zjhzb from (select Modelcode,(select CPGrade from t_ProductInfo where CPModel=a.Modelcode) as nx, (select GGID from tp_Standard where GGID=(select CPStandardID from t_ProductInfo where CPModel=a.Modelcode)) as ggdm, (select GGName from tp_Standard where GGID=(select CPStandardID from t_ProductInfo where CPModel=a.Modelcode)) as gg, (select CPMendCash from t_ProductInfo where CPModel=a.Modelcode) as bz , (select CPForcedValue from t_ProductInfo where CPModel=a.Modelcode) as GL , (select CPBrand from t_ProductInfo where CPModel=a.Modelcode) as CPB , (select CPModel from t_ProductInfo where CPModel=a.Modelcode) as MD from t_Itemlist as a where ((ReportYear=0 or ReportYear=2010 or reportyear is null)) and (ReportMonth in (0)) and (SaleMode is null or SaleMode<>'退货')and (BuyerAreaID like '11*') ) as aa group by nx,ggdm,gg,bz,GL,CPB,MD
select nx,nx as nx1,ggdm,gg,MD, GL,CPB,count(*) as sl,bz,bz as je,'0' as ls into zjhzb from (select Modelcode,(select CPGrade from t_ProductInfo where CPModel=a.Modelcode) as nx, (select GGID from tp_Standard where GGID=(select CPStandardID from t_ProductInfo where CPModel=a.Modelcode)) as ggdm, (select GGName from tp_Standard where GGID=(select CPStandardID from t_ProductInfo where CPModel=a.Modelcode)) as gg, (select CPMendCash from t_ProductInfo where CPModel=a.Modelcode) as bz , (select CPForcedValue from t_ProductInfo where CPModel=a.Modelcode) as GL , (select CPBrand from t_ProductInfo where CPModel=a.Modelcode) as CPB , (select CPModel from t_ProductInfo where CPModel=a.Modelcode) as MD from t_Itemlist as a where ((ReportYear=0 or ReportYear=2010 or reportyear is null)) and (ReportMonth in (0)) and (SaleMode is null or SaleMode<>'退货')and (BuyerAreaID like '11*') ) as aa group by nx,ggdm,gg,bz,GL,CPB,MD
解决方案 »
- fmOpenWrite与fmOpenReadAndWrite有什么区别
- 100分求教:如何把QuickReport报表转换为Word文档?
- 大家帮帮忙指点一下! groupbox嵌套后不可用
- ADO数据库编程中,TADOQuery中并没有MasterSource可选为主从表,那么,我们应该怎么实现主从表的操作呢?
- 李维《系统篇》中第二章关于动态SQL的例子(2-30页) DynamicSQLDemo的错误怎么解决呀?
- 调用DLL的问题
- 请教
- 开发流程?
- TStringGrid 点击表格某一行,怎么把这行所有列的数据得到?事件OnSelectCell 不行呀?
- 简体to繁体,how?
- 如何关闭OCX的网页?
- 给新人指明一条学习之路
select nx,nx as nx1,ggdm,gg,MD, GL,CPB,count(*) as sl,bz,bz as je,'0' as ls into zjhzb from
(select Modelcode,(select CPGrade from t_ProductInfo where CPModel=a.Modelcode) as nx,
(select GGID from tp_Standard where GGID=(select CPStandardID from t_ProductInfo where CPModel=a.Modelcode)) as ggdm,
(select GGName from tp_Standard where GGID=(select CPStandardID from t_ProductInfo where CPModel=a.Modelcode)) as gg,
(select CPMendCash from t_ProductInfo where CPModel=a.Modelcode) as bz ,
(select CPForcedValue from t_ProductInfo where CPModel=a.Modelcode) as GL ,
(select CPBrand from t_ProductInfo where CPModel=a.Modelcode) as CPB ,
(select CPModel from t_ProductInfo where CPModel=a.Modelcode) as MD from t_Itemlist as a
where
((ReportYear=0 or ReportYear=2010 or reportyear is null))
and (ReportMonth in (0))
and (SaleMode is null or SaleMode<>'退货')
and (BuyerAreaID like '11*') )
as aa group by nx,ggdm,gg,bz,GL,CPB,MD
如果去掉and (BuyerAreaID like '11*')就可以查到数据,请高手帮忙