gpt4 book ai didi

MYSQL:选择位置

转载 作者:行者123 更新时间:2023-11-29 19:09:46 26 4
gpt4 key购买 nike

假设我有下表:

 ID, Name  ,insurance , per_diem, net_salary, rr, rent, other_allowances 
1, John 1000 0 2000 0 0 0
2, Jim 1000 0 2000 0 0 0
3, Steve 500 0 3000 0 0 0
4, Tom 0 0 0 0 0 0

我运行以下查询

SELECT Sum((((((applicant.insurance + applicant.per_diem) +
applicant.net_salary) + applicant.rr) + applicant.rent) +
applicant.other_allowances)) As available_fund
WHERE applicant.id = id;
From applicant

我想得到每个人的总和之类的东西

可能吗?

最佳答案

您必须先使用from,然后使用where

     SELECT Sum(applicant.insurance + applicant.per_diem + 
applicant.net_salary + applicant.rr + applicant.rent +
applicant.other_allowances) As available_fund
From applicant
group by applicant.id

它将给出所有员工的总和,但如果您想获得一些特定的员工,请输入where条件

 WHERE applicant.id = id

关于MYSQL:选择位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43178132/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com