table('buy_info') . $where2; goods_amount和good_user_rate是数据库的两个字段,请问正确的写法是怎样?"/> table('buy_info') . $where2; goods_amount和good_user_rate是数据库的两个字段,请问正确的写法是怎样?">
Home > Backend Development > PHP Tutorial > mysql计算两个字段的积的总和

mysql计算两个字段的积的总和

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:24:28
Original
3094 people have browsed it

$sql1 = "SELECT SUM(goods_amount*goods_user_rate) FROM " . $GLOBALS['ecs']->table('buy_info') . $where2;

goods_amount和good_user_rate是数据库的两个字段,请问正确的写法是怎样?

回复内容:

$sql1 = "SELECT SUM(goods_amount*goods_user_rate) FROM " . $GLOBALS['ecs']->table('buy_info') . $where2;

goods_amount和good_user_rate是数据库的两个字段,请问正确的写法是怎样?

select sum(price * num) from table

SELECT SUM(ret) FROM(
SELECT goods_amount*goods_user_rate as ret FROM xxxx
);
我知道这样傻的写法是可以的。

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template