Note that there are some explanatory texts on larger screens.

plurals
  1. POselect records inserted in last 20 minutes
    primarykey
    data
    text
    <p>I have fairly simple table, in which the field lastloginon is timestamp and the date stored in it looks like this: 2013-03-17 17:12:58</p> <p>How can i select all records that are isnerted in last 20 minutes? </p> <p>I am trying with the following code:</p> <pre><code> SELECT * FROM who_is_online WHERE lastloginon &gt; (now() - interval 20 minute) </code></pre> <p>which produce wrong set of results that is event the qyery is executed at 15:30 it display 4 records which are inserted at:</p> <pre><code>2013-03-18 13:13:36 2013-03-18 13:35:12 2013-03-18 14:43:42 2013-03-18 14:55:34 </code></pre> <p>Anyone know what i am doing wrong?</p> <p>Here is the table export, just in hope that someone can spot what i am doing wrong:</p> <pre><code>CREATE TABLE IF NOT EXISTS `who_is_online` ( `recid` int(11) NOT NULL auto_increment, `username` varchar(255) default NULL, `lastloginon` timestamp NOT NULL default CURRENT_TIMESTAMP, `memberip` varchar(255) default NULL, `sessionid` varchar(255) NOT NULL, `active` tinyint(4) default NULL, PRIMARY KEY (`recid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ; -- -- Dumping data for table `who_is_online` -- INSERT INTO `who_is_online` (`recid`, `username`, `lastloginon`, `memberip`, `sessionid`, `active`) VALUES (7, ' admin', '2013-03-17 14:43:43', '87.202.163.222', '7kve2idmdbd47aksab4j9hqg74', 1), (8, ' mmitechnic', '2013-03-17 15:16:39', '5.54.84.144', 'mofgpldp2lu30enhitvak9m4t3', 1), (9, ' theodor71', '2013-03-17 17:12:58', '85.75.243.246', '4enpk49oi7cg0blumgsd0lu0m7', 1), (10, ' xElfiex', '2013-03-18 12:38:05', '5.55.27.203', 'tr003d6qbd71v2i5grnuako362', 1), (11, ' admin', '2013-03-18 12:56:06', '85.74.166.110', '7kve2idmdbd47aksab4j9hqg74', 1), (12, ' xElfiex', '2013-03-18 13:13:36', '5.55.27.203', 'tr003d6qbd71v2i5grnuako362', 1), (13, ' admin', '2013-03-18 13:35:12', '85.74.166.110', '7kve2idmdbd47aksab4j9hqg74', 1), (14, ' admin', '2013-03-18 14:43:42', '85.74.166.110', '7kve2idmdbd47aksab4j9hqg74', 1), (15, ' admin', '2013-03-18 14:55:34', '85.74.166.110', '7kve2idmdbd47aksab4j9hqg74', 1), (16, ' admin', '2013-03-18 15:32:27', '85.74.166.110', '7kve2idmdbd47aksab4j9hqg74', 1); </code></pre> <p>Regards,Zoran</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