MySQL条件
我对 MySQL 还很陌生,我不知道最好的方法。
我有一个包含递增值的表,如果这些值超过某个限制,我想知道。假设我有一个带有 current
列和 capacity
列的表。 current
中的一行根据用户输入递增,我想知道 current
行中的值何时超过或满足其相应的capacity
。
如果当前
仍然低于容量
,我希望查询返回true。但是,如果 current
满足或超过 capacity
,我希望查询返回 false。
谢谢!
I'm still pretty new with MySQL and I don't know the best way to do this.
I have a table with incremented values, and if the values exceed a certain limit, I'd like to know. So lets say I have this table with a current
column and capacity
column. A row in current
is incremented by user input and I want to know when the value in a current
row exceeds or meets its corresponding capacity
.
If current
is still below the capacity
, I would like the query to return true. However, if current
meets or exceeds capacity
, I would like the query to return false.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 mysql 中这很简单:
in mysql that's easy:
添加一个
WHERE
子句来检查您的UPDATE
查询:然后检查
UPDATE
查询的mysql_affected_rows()
:Add a
WHERE
clause to do that check in yourUPDATE
query:Then check
mysql_affected_rows()
of theUPDATE
query: