gpt4 book ai didi

mysql - 查询加法和乘法值

转载 作者:行者123 更新时间:2023-11-29 01:23:28 24 4
gpt4 key购买 nike

我的表格如下

int_id      Born         Died
1 2001 0
2 2002 0
3 1991 0
4 1992 0
5 1987 1995
6 1986 1993
7 1985 1998

据此,我需要查询仅显示死者,确定他们死时的年龄并将该值乘以 3。

我一直在尝试使用 phpMyAdmin 来执行此操作,但到目前为止还没有弄清楚。将不胜感激任何帮助。

最佳答案

您尝试过吗,呃...减法和乘法?

SELECT 
int_id,
Died - Born AS age_died,
3 * (Died - Born) AS age_died_tripled
FROM my_table
WHERE Died > 0;

关于mysql - 查询加法和乘法值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10393577/

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