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语句。谢谢!
解决方案 »
- 求救!!用vb向oracle中BLOB字段导入数据奇怪错误!
- 面对oracle数据库不知道如何下手该怎么办
- 求助TMS_ORA的问题
- 挑战--求分页显示(普适解决方案)
- 在windows 2003 中如何配置Oracle 9i HTTP服务器
- 如何指定一个过程在个一个时间执行一次????
- 有关的execute immediate问题
- pl/sql怎么返回数据集?
- 急,在线等待,为什么oracle执行sql语句的速度比sql server速度还慢许多 ?具体请看文章内容,高手救急啊
- Oracle中的分页语句怎么写?
- [求教]如何去掉killed的session?
- pl/sql developer中如何导出oracle数据库结构?
一般数据重复,是条件不足造成的