diff --git a/apps/schedulers/tasks.py b/apps/schedulers/tasks.py index a4022c0..8bc6d19 100644 --- a/apps/schedulers/tasks.py +++ b/apps/schedulers/tasks.py @@ -477,7 +477,7 @@ def load_sotekom(): cursor_device_model = cursor.fetchall() for device_model in cursor_device_model: element.model = device_type[1] - SQL_QUERY = r'SELECT * FROM vw_WDATA_POSITION WHERE Machine = ' + "'" + str(data[1]) + "' ORDER BY AtTime DESC TOP 1" + SQL_QUERY = r'SELECT TOP 1 * FROM vw_WDATA_POSITION WHERE Machine = ' + "'" + str(data[0]) + "' ORDER BY AtTime DESC " cursor = mssql.executeSQL(conn,SQL_QUERY) cursor_position = cursor.fetchall() for position in cursor_position: