以下查询返回所有客户端的记录,会话$_SESSION['client_id']
值为3
。
查询工作正常,但它返回所有客户端的记录。我想在所有SELECT Clauses
上应用会话值。
SELECT mrk_lat,client_id,mrk_lng ,engine_status ,created_date,live_fuel,
(SELECT count(driver_id) FROM we_drivers) as total_drivers,
(SELECT count(veh_id) FROM we_vehicles) as total_veh,
(SELECT count(veh_status) FROM we_vehicles WHERE veh_status=1) as run_veh,
(SELECT count(veh_status) FROM we_vehicles WHERE veh_status=0) as stop_veh,
(SELECT client_id FROM we_clients WHERE client_id =" . $_SESSION['client_id'] . ")
FROM `we_vehicles_coordinates`