1
我有一個表(學生)與Postgres的9.5以下架構的更新語句:如何執行與where子句爲select語句
id | marks | division | class
1 90 A 1
2 90 B 2
3 90 B 1
我想與1類和標誌更新學生的部門= 90到「A」。
我知道我可以簡單地使用update student set division='A' where class =1 and marks=90
但這瞭解如何使用select語句查詢返回多個行。 Somethig像:
update student set division ='A' where id=(select id from student where class=1 and marks=90)
我是新來的Postgres。一些指針會有所幫助。
'WHERE ID IN(SELECT ID。 ...)' – AlexM