Mysql – theSQL query Where issue

MySQLsql

Could somebody tell me what am I doing wrong here?

$query = "SELECT * 
            FROM routes 
           WHERE econ <> maxecon 
        ORDER BY `id`;";

Without the WHERE, it works fine so I know that's the problem.

I want to select data where the column econ is NOT equal to maxecon. Is this even possible at this stage or do I have to take it all and chop it out in a loop?

Best Answer

Does replacing <> with != work?

$query = "SELECT * FROM routes WHERE econ != maxecon ORDER BY `id`";

Also, you don't need to include the ending semi-colon in your sql statement.