简体   繁体   中英

Find rows where one field is greater than another one

My SQL is a bit rusty. 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. Any ideas?

Thanks for the help!

Specify the desired columns between the SELECT and FROM and your predicates after the 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.

Did you try

Select *
From table 
where CreatedAt < UpdatedAt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM