insert into mail
(id, userid, teacherid, title, content, type)
select id.nextval, u.id, s.teacherid, 'title:' || m.title, m.content, 2
from usercourse uc,
users u,
schedules s,
(select *
from msong
where trunc(createdate) =
(select next_day(last_day(trunc(sysdate, 'mm')) - 7,
'星期三') - 1
from dual)) m
where s.usercourseid = uc.id
and uc.userid = u.id
and s.lessontime > sysdate
and trunc(to_date(uc.finaldate, 'yyyy-mm-dd hh24:mi:ss')) >=
trunc(sysdate) + 7msong是单独的一张表,无关系。我这样写,数据会重复,distinct和group by都用过,因为content这字段是CLOB类型的,用不了。可以有什么方法把重复数据去掉?或者帮我改下这SQL语句。谢谢!
(id, userid, teacherid, title, content, type)
select id.nextval, u.id, s.teacherid, 'title:' || m.title, m.content, 2
from usercourse uc,
users u,
schedules s,
(select *
from msong
where trunc(createdate) =
(select next_day(last_day(trunc(sysdate, 'mm')) - 7,
'星期三') - 1
from dual)) m
where s.usercourseid = uc.id
and uc.userid = u.id
and s.lessontime > sysdate
and trunc(to_date(uc.finaldate, 'yyyy-mm-dd hh24:mi:ss')) >=
trunc(sysdate) + 7msong是单独的一张表,无关系。我这样写,数据会重复,distinct和group by都用过,因为content这字段是CLOB类型的,用不了。可以有什么方法把重复数据去掉?或者帮我改下这SQL语句。谢谢!
解决方案 »
- oracle中设计一个新闻表,表有两列,一列存新闻标题,一列存新闻内容。 新闻内容超长,我该怎么存
- 大家帮忙看看,能不能用sql查出这样的结果
- ora-06504的问题,跪求各位高手解答
- 请教一条SQL语句
- win平台下访问oracle数据库引擎的问题,1000个大元
- 请教,安装oracle10g对计算机有什么要求?
- 寻Oracle参考手册
- oracle中的问题,网络适配器不能建立连接,大家一定要帮帮我!!!!!
- vmware esxi虚拟主机部署ORACLE 11G RAC--咨询帖
- Oracle Database11g怎么设置并使用外部的JDK1.8
- [求教]如何去掉killed的session?
- pl/sql developer中如何导出oracle数据库结构?
一般数据重复,是条件不足造成的