lundi 12 septembre 2016

IF type stement in MYSQL

Im trying to create a query in MySQL based on an IF type statement but am unsure how to script it. Im new to MySQL and database querying in general, so if convention dictates that this type of query is created further upstream just say.

For context I have 4 fields:

ID, YEAR, SYSTEM, MEASURE

I want to identify all ID where difference between YEAR = '2015' and YEAR = '2014' is greater than 500.

I'm not sure if you do this via an IF statement, in the WHERE clause, or use two SELECT statements.

I have not been required to do such a complex query on a database before

Aucun commentaire:

Enregistrer un commentaire