易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL联表更新,联表查询

没有引用关系的表
 1. 联表更新
update  a set a.education = '本科' from NT_UserInfo a ,NT_User b where  a.UserID=b.UserID and b.email = 'carlfan2008@163.com'
2. 联表查询
select a.*,b.* from nt_user as a, nt_userinfo as b where a.userid = b.userid and Email = 'carlfan2008@163.com'


相关文档:

sybase数据库中索引导致sql语句执行不成功

SELECT DISTINCT A.CASEPROP AS PROP,'旧存' AS AJLX,0 AS AJLXXH,A.CASE_PROP AS PROPNO 
 ,M1=( SELECT COUNT(*) from CASES WHERE CASEPROP=A.CASEPROP AND
(PERMITDAY <'2008.12.26 00:00:00' AND (SHUTDAY IS NULL OR
SHUTDAY<'1900-01-01 00:00:00' OR SHUTDAY>='2008.12.26 00:00:00') )) ......

SQL 通用存储过程


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/ ......

Sql 2005 递归查询

 Oracle中的递归查询可以依靠增强的sql语句START WITH ...CONNECT BY PRIOR来搞定.sql 2005中不支持该语句,以下示例可以实现递归查询.
WITH TREE(xzdm,Prexzdm,lvl,topxzdm)
AS
(
    SELECT xzdm,prexzdm,1,prexzdm as topxzdm from xzdm WHERE Prexzdm = '000000000000'
 &nbs ......

sql 交叉表

交叉表语句的实现:
  用于:交叉表的列数是确定的
  select name,sum(case subject when '数学' then source else 0 end) as '数学',
  sum(case subject when '英语' then source else 0 end) as '英语',
  sum(case subject when '语文' then source else 0 end) as '语文'
  from test
  group by name ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号