How to check if one column value is greater than another in mysql


Problem :

I would like to get results where value in one column is greater than values in another.

Example

select * FROM myTable where column time_taken is greater than time_spent

Thanks for the help.



Solution :

select * FROM myTable where time_taken > time_spent

To see a list of other operators available in MySql, have a look at http://dev.mysql.com/doc/refman/5.0/en/non-typed-operators.html


Mysql Tutorials

Mysql Howto..

How do I get data back from Paypal so I can alter my MySQL database accordingly?

how to select all of duplicate record in mysql

How to search for Soundex() substrings in MySQL?

How to print the string variable in mysql

How to get string as date in mysql?

MySql stored procedure - how to select multiple ids into a variable

How to import large excel file table to MySQL database table

How to transfer mysql table to hive?

How to open remote mysql database on windows from command prompt

How to access MySQL Python Connector with Python 2.7.8 and Sublime Text 3 on OS X 10.9

How to force PHP to release memory after script is finished

Populating Drop Down Menu from PHP/MYSQL Select Values. How to rearrange output

How to inner join 3 tables using mySQL?

How could I build a statistical map?

How to send Personal Message using AJAX, PHP and MySQL?

how to compare binary in mysql with JAVA

How to session variable work with IN clause using MySQL?

How to execute different query based on the result got from executing query in mysql?

How do I convert binary data from MySQL to a string in ColdFusion 11?

How can I make my GTFS queries run faster?

How to populate dropdown list from mysql db and based on selection populate another dropdown list in php form?

how to output the same MYSQL column twice as JSON

how to store mysql connection data safely? [duplicate]

How to eliminate “duplicate” URL MySQL rows which may or may not start with www?

How to Stop inserting username field as Empty in MySQL database using PHP ?

How to find old rows not in the top 10 and delete them using MySQL

How to order by field if it contains number and text in mysql

How to find this ^ in a specific position of a pattern

How to migrate data from FoxPro to MySQL

How to search for record in mysql using php?