一个多表嵌套查询的sql语句
select batch_no "批次号",get_id "分类" from (
select(
select plan1.batch_no from product_plan plan1 where plan1.item_no=(select head1.product_code from wo_head head1 where head1.order_no =bbb)) batch_no,
(select decode(get_id,'BUY','外购件','MAK','自制件','MB','未定') from item where item_no= aaa) get_id
from (select req.item_no aaa,req.order_no bbb from process_req req where req.status_id='C'and req.order_no in(select head.order_no from wo_head head where head.batch_no in (select batch_no from product_plan) or head.product_code in ( select item_no from product_plan )))) order by qty desc
相关文档:
1.select * into [表] from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=D:\VFP\jspg\QuickEval2.5\Export\20092\dgqxps.xls',dgqxps$)
若遇到SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问,因为此组件已作为此服务器安全配置的一部分而 ......
PL/SQL Developer使用技巧
1、PL/SQL Developer记住登陆密码
在使用PL/SQL Developer时,为了工作方便希望PL/SQL Developer记住登录Oracle的用户名和密码;
设置方法:PL/SQL Developer 7.1.2 ->tools->Preferences->Oracle->Logon History , "Store history"是默认勾选的,勾上"Store wi ......
定义:何为触发器?在SQL Server里面也就是对某一个表的一定的操作,触发某种条件,从而执行的一段程序。触发器是一个特殊的存储过程。
常见的触发器有三种:分别应用于Insert , Update , Delete 事件。
我为什么要使用触发器?比如,这么两个表:
&n ......
为了执行sql语句,我们会在access数据库中执行sql语句,这样方便我们分析。方法如下:
打开access数据库,点击”创建“,在单击“查询设计”,会弹出一个显示表的窗口,关掉。会出现一个sql试图,打开就可以再里面写sql代码了。 ......
EXEC和sp_executesql的区别?
DBCC FREEPROCCACHE --》清空缓存中的执行计划
SELECT cacheobjtype,objtype,usecounts,sql from sys.syscacheobjects WHERE sql NOT LIKE '%cach%' AND sql NOT LIKE '%sys.%' --》查找对应的缓存中的对应计划
SQL Server为每一个的查询字符串创建新的执行计划,即使查询模式相同也是这样
......