PL / SQL如何对表中的值求和

时间:2014-03-21 16:58:23

标签: sql oracle

CREATE TABLE tb_low_qty 
( tb_id serial NOT NULL, 
tb_pt_code integer, 
tb_pt_name character varying(128), 
tb_pt_qty numeric, 
tb_move_name character varying(250), 
CONSTRAINT tb_low_qty_pkey PRIMARY KEY (tb_id) )

我想总结tb_pt_qty,其中tb_pt_code = tb_pt_code 如何创建pl / sql?

1 个答案:

答案 0 :(得分:0)

请检查以下查询

SELECT SUM(tb_pt_qty) AS tb_pt_qty FROM tb_low_qty WHERE  tb_pt_code =  Your Value