+ 1

How to get a print on SQL based on intervals?

Select Kilometers IF ('Kilometers' >1000, 'Car service soon', 'no service yet') AS service_info From car_rental So, the print "car service soon" should appear at 14000, 29000, 44000 etc. When it's 1000 left for the next service. Any input??

1st Jun 2020, 11:42 AM
W. Khalid
1 Respuesta
+ 1
Haven't tested yet, but maybe you can try SELECT IF(`Kilometers` IN( 14000, 29000, 44000 ), ' Car service soon', ' No service yet') AS service_info FROM car_rental;
25th Jun 2020, 9:26 AM
Ipang