MySQL Filter Expired Permissions

0

I have the following question:

I have a table in mysql called drivers in which I keep your data including Date of Issued driver's license and Expiry date. What I need is to filter "Show" all those that are about to expire or have already expired. in my country they expire every 4 years. Here I show my table:

    
asked by Riddick 15.11.2017 в 21:08
source

1 answer

0

Try this sentence:

SELECT licenciaexpedida
    , licenciaexpira
    , CASE WHEN  locenciaexpira > DATE_ADD(licenciaexpedida, INTERVAL 4 YEAR)
        THEN 'Expirada' ELSE 'Vigente' END
FROM TuTabla

Greetings.

    
answered by 15.11.2017 в 21:16