2531
2531
`itemid` bigint unsigned NOT NULL auto_increment,
2532
2532
`sessionid` bigint unsigned default NULL,
2533
2533
`time` int unsigned NOT NULL default '0',
2534
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
2536
2534
`data` text collate latin1_general_ci NOT NULL,
2537
2535
PRIMARY KEY (`itemid`)
2538
2536
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
2539
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
2537
INSERT INTO `t1` VALUES (1, 1, 1, '');
2540
2538
CREATE TABLE `t2` (
2541
2539
`sessionid` bigint unsigned NOT NULL auto_increment,
2542
2540
`pid` int unsigned NOT NULL default '0',
2970
2968
DROP TABLE t1,t2,t3;
2972
`itemid` bigint unsigned NOT NULL auto_increment,
2973
`sessionid` bigint unsigned default NULL,
2974
`time` int unsigned NOT NULL default '0',
2975
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
2977
`data` text collate latin1_general_ci NOT NULL,
2978
PRIMARY KEY (`itemid`)
2979
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
2980
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
2982
`sessionid` bigint unsigned NOT NULL auto_increment,
2983
`pid` int unsigned NOT NULL default '0',
2984
`date` int unsigned NOT NULL default '0',
2985
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
2986
PRIMARY KEY (`sessionid`)
2987
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
2988
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
2989
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
2990
ip count( e.itemid )
2993
2969
CREATE TABLE t1 (EMPNUM CHAR(3));
2994
2970
CREATE TABLE t2 (EMPNUM CHAR(3) );
2995
2971
INSERT INTO t1 VALUES ('E1'),('E2');