Alphabet_123 Posted August 24, 2023 Share Posted August 24, 2023 Buenos días ¿Como podría realizar una consulta sql para obtener cuándo fue la última conexión de un cliente, y que además, se mostrara su ID, nombre y email? Muchas gracias! Link to comment Share on other sites More sharing options...
ExpertoPrestaShop Posted August 24, 2023 Share Posted August 24, 2023 Esta es la consulta que usa PS en Customer::getLastConnections() SELECT c.id_connections, c.date_add, COUNT(cp.id_page) AS pages, TIMEDIFF(MAX(cp.time_end), c.date_add) as time, http_referer,INET_NTOA(ip_address) as ipaddress FROM `' . _DB_PREFIX_ . 'guest` g LEFT JOIN `' . _DB_PREFIX_ . 'connections` c ON c.id_guest = g.id_guest LEFT JOIN `' . _DB_PREFIX_ . 'connections_page` cp ON c.id_connections = cp.id_connections WHERE g.`id_customer` = ' . (int) $this->id . ' GROUP BY c.`id_connections` ORDER BY c.date_add DESC LIMIT 10 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now