[英]Find rows where one field is greater than another one
My SQL is a bit rusty. 我的SQL有点生锈。 I'm not been able to find a way to retrieve rows where one value is greater than the other one. 我无法找到一种方法来检索其中一个值大于另一个值的行。 For example, I have the following row: 例如,我有以下行:
{
ROWID 1,
CreatedAt 2013-08-03 10:10:23:344,
UpdatedAt 2013-08-03 11:10:23:344,
}
I would like to perform the query 'select all rows where 'UpdatedAt' is greater than 'CreatedAt' and match rows such the one above. 我想执行查询“选择'UpdatedAt'大于'CreatedAt'的所有行,并匹配上述行。 Any ideas? 有任何想法吗?
Thanks for the help! 谢谢您的帮助!
Specify the desired columns between the SELECT
and FROM
and your predicates after the WHERE
. 在SELECT
和FROM
以及WHERE
之后的谓词之间指定所需的列。
SELECT ROWID, CreatedAt, UpdatedAt FROM TableName WHERE UpdatedAt > CreateAt;
Remember with SQL that if all of the predicates in your query do not evaluate to True
in some way, the row will not return. 请记住,使用SQL请注意,如果查询中的所有谓词都不以某种方式求值为True
,则该行将不会返回。
Did you try 你试过了吗
Select *
From table
where CreatedAt < UpdatedAt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.