Taborders 其中OrderCode是唯一的
-----------------------------------
id ¦OrderCode ¦Prices
1 ¦[email protected] ¦1000
2 ¦[email protected] ¦800
------------------------------------
taborder_clild 其中的每一个O_code 都并不是唯一,但是和TABLE1中一一对应
------------------------------------
id ¦O_code ¦gongji
1 ¦[email protected] ¦100
2 ¦[email protected] ¦50
3 ¦[email protected] ¦200
------------------------------------ tabsend_child 其中ordercode(注意是小写)是唯一的,与table1中的Taborders 对应,但是price不一样
--------------------------------
id ¦ordercode ¦yunfei
1 ¦[email protected] ¦500
2 ¦[email protected] ¦1000
----------------------------------
问题是这样的: 从Taborders中读取OrderCode和Prices,让Taborders中的Prices减去taborder_clild中对应的O_code的gongji相加的和,然后与tabsend_child中对应的ordercode的yunfei进行比较,,小于tabsend_child中的显示在dbgrid中
-----------------------------------
id ¦OrderCode ¦Prices
1 ¦[email protected] ¦1000
2 ¦[email protected] ¦800
------------------------------------
taborder_clild 其中的每一个O_code 都并不是唯一,但是和TABLE1中一一对应
------------------------------------
id ¦O_code ¦gongji
1 ¦[email protected] ¦100
2 ¦[email protected] ¦50
3 ¦[email protected] ¦200
------------------------------------ tabsend_child 其中ordercode(注意是小写)是唯一的,与table1中的Taborders 对应,但是price不一样
--------------------------------
id ¦ordercode ¦yunfei
1 ¦[email protected] ¦500
2 ¦[email protected] ¦1000
----------------------------------
问题是这样的: 从Taborders中读取OrderCode和Prices,让Taborders中的Prices减去taborder_clild中对应的O_code的gongji相加的和,然后与tabsend_child中对应的ordercode的yunfei进行比较,,小于tabsend_child中的显示在dbgrid中
解决方案 »
- TeeChart怎么导出txt或jpg?
- 我在Delphibbs上提的一个问题,有几天了都没解决郁闷...关于FastReport
- 安装盘上的内容一样,系统环境也没有变,还是同一台机子,昨天还能用,今天就不能用了。在线等
- BDE配置的问题
- 救救我啊!都三天了!!!分不够另开帖!!TSQLStoredProc执行MSSQLserver2000中的存储过程,出现“list index out of bounds(0)”的错误!
- 对多个TEDIT控件的统一操作,
- 如何保存当前窗体的运行状态?
- 各位前辈大侠,我用WIN2000+DELPHI6时,为什么与WIN98下不一样,每次运行程序就会弹出一个名为“CPU”的窗口来,我不断的运行,很久后才
- 用Variant操作Excel时,如何才能读出Excel中的一个给定格子的数据并其放入string变量里?
- 我在开发一个单位的管理系统,为了安全得做一个像win9x一样得桌面
- intraweb 发布到IIS后,为何读取不到DLL路径的INI文件内容,注册表也读取不到,EXE是OK的!
- SQL语句问题求助
select a.ordercode,a.Prices from (select a.ordercode,a.Prices,b.Prices-a.g as p from (select ordercode,sum(gongji) g from taborder_child group by ordercode) a,Taborders b
where a.ordercode=b.ordercode) a,tabsend_child b
where a.ordercode=b.ordercode and a.p<b.yunfei
select d.*
from tabsend_child c,
(select a.OrderCode, nvl((a.Prices - b.gongji), 0) Prices
from Taborders a,
(select distinct O_code, sum(gongji) gongji
from taborder_clild
group by O_code) b
where a.OrderCode = b.O_code) d
where c.ordercode = d.OrderCode
and d.Prices < c.yunfei
(select a.code as ordercode,b.Prices-a.g as p from
(select O_code as code,sum(gongji) as g from taborder_clild group by O_code) a,Taborders b
where a.code=b.ordercode) c,tabsend_child d
where c.ordercode=d.ordercode and c.p<d.yunfei结果:
ordercode p
[email protected] 750