时间:2021-05-24
sql语句:
复制代码 代码如下:
update item i,resource_library r,resource_review_link l set i.name=CONCAT('Review:',r.resource_name) where i.item_id=l.instance_id
and l.level='item' and r.resource_id=l.resource_id and i.name=''
JOIN UPDATE & JOIN DELETE
复制代码 代码如下:
update a
set a.schoolname = b.schoolname
from tb_Std as a join tb_Sch as b on a.School = b.School
where a.std_year = 2005
go
select *
from tb_Std as a join tb_Sch as b on a.School = b.School
复制代码 代码如下:
delete a
from table1 a, table2 b
where a.col1 = b.col1
and a.col2 = b.col2
The above SQL statement runs fine in SQL Server.
If the Oracle 9i has different syntax or if there is any other way to accomplish this with a single delete statement that would be really helpful.
> Hi,
>
> Is the following delete statement possible in Oracle 9i.
>
> delete a
> from table1 a, table2 b
> where a.col1 = b.col1
> and a.col2 = b.col2
>
> The above SQL statement runs fine in SQL Server.
>
> If the Oracle 9i has different syntax or if there is any other way to accomplish this with a single delete statement that would be really helpful.
>
> Thanx in advance.
>
> -Bheem
Bheem,
Try this:
DELETE FROM table1 a where exists (select 1 from table2 b
where a.col1 = b.col1 and a.col2 = b.col2);
Hope this helps,
Tom K.
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
MySQL多表join时报错如下:[Err]1267–Illegalmixofcollations(utf8_general_ci,IMPLICIT)and(u
update:单表的更新不用说了,两者一样,主要说说多表的更新复制代码代码如下:Oracle>Oracle的多表更新要求比较严格,所以有的时候不是很好写,我们可
有些时候我们需要同时更新多个表中的数据那么就需要用到下面方法了:(1)sqlite多表更新方法复制代码代码如下://----------------------
前言在mysql中,多表连接查询是很常见的需求,在使用多表查询时,可以from多个表,也可以使用join连接连个表这两种查询有什么区别?哪种查询的效率更
查询是数据库的核心,下面就为您介绍Mysql多表查询时如何实现的,如果您在Mysql多表查询方面遇到过问题,不妨一看。Mysql多表查询:复制代码代码如下:CR