Reputation: 2082
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!
Upvotes: 6
Views: 21571
Reputation: 1347
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.
Upvotes: 14