gpt4 book ai didi

mysql - 将值从列保存到变量

转载 作者:行者123 更新时间:2023-11-29 18:15:44 25 4
gpt4 key购买 nike

如何将列中的值保存到变量?

我的 table :

+------+------+----------+-------------+---------------------+
| id | hwid | password | force | created |
+------+------+----------+-------------+---------------------+
| 0004 | 4 | NULL | 1 | 2017-10-31 17:28:23 |
+------+------+----------+-------------+---------------------+

我想将力的“1”保存在变量中。

目前我有这个:

force=$(mysql -h$host -u$user -p$password -e "SELECT force FROM $database_name.settings WHERE hwid = '$hwid'")

我的结果是:

forceupdate 1

但我只想要 1(或 0)作为结果。我该怎么做?

谢谢!

最佳答案

试试这个

force="${force#* }";echo "$force"

关于mysql - 将值从列保存到变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47043865/

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