hibernate sql 操作
@SuppressWarnings("unchecked")
public List<ZxFunction> selectFunctionParentByUserId(final int userId) {
try {
final String sql = "select * from zx_function where f_id in ( select distinct f.f_parent_id from zx_function f,zx_permission p where p.f_id = f.f_id and p.u_id = ?)";
return (List<ZxFunction>) getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
SQLQuery query = session.createSQLQuery(sql).addEntity(ZxFunction.class);
query.setInteger(0, 1);
return query.list();
}});
} catch (Exception e) {
CommonsLog4jUtil.printToConsole(e);
CommonsLog4jUtil.error("FunctionDaoImpl public List<UserFunction> selectFunctionParentByUserId() Error:", e);
return null;
}
}
@SuppressWarnings("unchecked")
public List<UserFunction> selectFunction(final int userId) {
try {
final String sql = "select f.f_id as FId,&q
相关文档:
№1:取得当前日期是本月的第几周
SQL> select to_char(sysdate,'YYYYMMDD W HH24:MI:SS') from
dual;
TO_CHAR(SYSDATE,'YY
-------------------
20030327 4 18:16:09
SQL> select to_char(sysdate,'W') from dual;
T
-
4 ......
SQL语句复制表的方法
(2009-08-29 13:41:54)
标签:
sql
分类:计算机知识
如果目的表已经存在:
insert into DATAHR.DBO.GBITEM
select * from DEMO.DBO.GBITEM
如果目的表不存在:
select * into DATAHR.DBO.GBITEM
from DEMO.DBO.GBITEM
跨库导入
select * into [zk_news].[dbo].[News1] from [zk_media].[ ......
贺州市疾病预防控制中心所用的ZmSoft从业体检信息网络系统V2010.1.26 正式版采用SQL SERVER2000平台,不明原因,数据库"置疑“,客户试过所有网上方法,未能解决.沈阳凯文数据恢复中心SQL数据库工程师成功将其解决.
沈阳凯文数据恢复中心MS SQL SERVER研发小组致力于MsSql数据库技术的研究。经过多年研究完全掌握了S ......
Student(S#,Sname,Sage,Ssex) 学生表
Course(C#,Cname,T#) 课程表
SC(S#,C#,score) 成绩表
Teacher(T#,Tname) 教师表
问题:
1、查询“001”课程比“002”课程成绩高的所有学生的学号;
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
fr ......
sql server 临时表的使用 以及给临时表插入主键列
--某时间段内某组服务器的消费排行
CREATE PROCEDURE biling_order_consume
@begin_date datetime,
@end_date datetime
AS
select identity(int,1,1) as ID,charge_credit into #tmp from crm_biling
where @begin_date <= convert(datetime,convert( ......