Find rows where one field is greater than another one

sql, sqlite

Solution

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.

Problem

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!

Original source