MySql Query

CapReed 5 years ago

Good afternoon everyone.

First of all I want to thank Anton's work. In a world where everyone goes about their own business, it is a pleasure to meet projects and initiatives like this one.

I have a question, I hope it is not absurd ...

I need to know when is the last time the ignition attribute was true on the devices.

I think I know the Traccar API quite well, but I have not found any option that allows me to know when was the last time the device was with the ignition equal to True.

I have created a query in MySql and the result is as expected, but I don't know how I can retrieve the results from my browser, or by making a query via PHP.

SELECT *
FROM tc_positions
WHERE id IN (
    SELECT MAX (id)
    FROM tc_positions
    GROUP BY deviceId
) AND attributes LIKE '% "ignition": true%';

I don't know if it is possible to install Apache2 and PHP on the same server where I have Traccar hosted, or if it would be possible to obtain the result through the calculated attributes.

Thank you very much for your help.

Anton Tananaev 5 years ago

It won't be possible through computed attributes. But you should be able to install apache and PHP on the same server.

CapReed 5 years ago

Okay, I'm going to give it a try.

Thank you very much for your immediate response.

You have my respects.