Jump to content

Consulta SQL Última conexión cliente


Alphabet_123

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...