Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

要如何算出一個欄位的平均,然後再update 到另一 …

6 views
Skip to first unread message

菜虫

unread,
May 2, 1997, 3:00:00 AM5/2/97
to

※ 引述《boymonkey (小餃子)》之銘言:
: hi
: 請問一下我要如何使用sql語法,才能把在某一個table中的欄位平均值
: 算出來然後再update到另一個table,我最主要是不會update到另一個table
: 中的某一個欄位

UPDATE orders SET o_p_sum=(SELECT sum(price) FROM p WHERE

where_clause ) WHERE order_id=9832;

--
※ 來源:台灣科技大學BBS(bbs.et.ntit.edu.tw) ◆來自: 140.118.38.205

Tab Yeh

unread,
May 4, 1997, 3:00:00 AM5/4/97
to

菜虫 <doog...@bbs.et.ntit.edu.tw> 次寫入到主題
<3INWTg$Y...@bbs.et.ntit.edu.tw>...

> ※ 引述《boymonkey (小餃子)》之銘言:
> : hi
> : 請問一下我要如何使用sql語法,才能把在某一個table中的欄位平均值
> :
算出來然後再update到另一個table,我最主要是不會update到另一個table
> : 中的某一個欄位
> UPDATE orders SET o_p_sum=(SELECT sum(price) FROM p WHERE
> where_clause ) WHERE order_id=9832;
UPDATE table1 SET table1.col11=(SELECT AVG(table2.col21) FROM table2 WHERE
[WHERE CONDITION of table2]) WHERE table1.col12=table2.col22;


0 new messages