Note that there are some explanatory texts on larger screens.

plurals
  1. POFilter MySQL table using data from another table
    primarykey
    data
    text
    <p>I have one table containing "user sessions" and another to indicate violations in the system. One possible violation is having a user logged on for more than 12 hours straight.</p> <p>The tables are as followed:</p> <pre><code>notification: +--------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | host_id | int(11) | NO | MUL | NULL | | | alert_id | int(11) | NO | MUL | NULL | | | event_start | datetime | NO | | NULL | | | time_noticed | datetime | NO | | NULL | | | info | varchar(45) | YES | | NULL | | | seen | int(11) | NO | | NULL | | +--------------+-------------+------+-----+---------+----------------+ login: +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | username | varchar(45) | NO | | NULL | | | host_id | int(11) | NO | MUL | NULL | | | start | datetime | NO | | NULL | | | end | datetime | NO | | NULL | | | last | int(11) | NO | | NULL | | +----------+-------------+------+-----+---------+-------+ </code></pre> <p>The conditions I want for the result table are:<br> login.last = 1, login.host_id=X, end>start+12hours<br> and to make sure I didn't report this instance before:<br> login.host_id!=notification.host_id, notification.alert_id!=Y, login.start!=notification.event_start, login.username!=notification.info<br> (in other words, I don't want to get another report of the same user, on the same host, making the same violation which started at the same time)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload