关于#oracle#的问题:

oracle sql
有table1 table2两个表
条件是table1.apply_no = table2.apply_no
怎么取得table1.matter_no

关于#oracle#的问题:

oracle sql
有table1 table2两个表
条件是table1.apply_no = table2.apply_no
怎么取得table1.matter_no

要获取表1中的 Matter_no 字段,可以使用以下 SQL 语句: ``` SELECT table1. Matter_no FROM table1 INNER JOIN table2 ON table1.apply_no = table2.apply_no; ``` 其中,`table1` 和 `table2` 是用于连接两个表的关键字,`INNER JOIN` 表示两个表必须具有相同的索引和列,`ON` 语句指定了连接条件。在这个例子中,`apply_no` 列必须在两个表之间进行连接,并且连接条件为 `table1.apply_no = table2.apply_no`。因此,` Matter_no` 列在结果集中将根据这些条件返回表1中与表2中匹配的行中的 Matter_no 值。

关联查询?

select table1.matter_no from table1 inner join  table2 on table1.apply_no = table2.apply_no

要拿到table1表中的matter_no字段,可以这样试着写一下sql:

SELECT table1.matter_no
FROM table1 
JOIN table2 ON table1.apply_no = table2.apply_no;

这个sql语句使用了=join on操作符将表1和表2表连接在一起来查询的。


如果以上回答对您有所帮助,点击一下采纳该答案~谢谢