DROP TABLE IF EXISTS `table1`;
DROP TABLE IF EXISTS `rolledupmw`;

CREATE TABLE `table1` (
`tupleid` int(11) DEFAULT NULL,
`vbdata` VARBINARY(256) DEFAULT NULL,
`IngressAS` int(11) DEFAULT NULL,
`IngressRTR` int(11) DEFAULT NULL,
`IncomingIF` int(11) DEFAULT NULL) 
ENGINE=InfiniDB;

CREATE TABLE `rolledupmw` (
`tupleID` int(11) DEFAULT NULL, 
`week1` VARBINARY (1600) DEFAULT NULL, 
`week2` VARBINARY (1600) DEFAULT NULL, 
`week3` VARBINARY (1600) DEFAULT NULL, 
`week4` VARBINARY (1600) DEFAULT NULL, 
`week5` VARBINARY (1600) DEFAULT NULL) 
ENGINE=InfiniDB;

INSERT INTO `table1` VALUES (0, 0x303132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 295, 9);
INSERT INTO `table1` VALUES (1, 0x313032333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 63, 10);
INSERT INTO `table1` VALUES (2, 0x323031323435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 64, 11);
INSERT INTO `table1` VALUES (3, 0x333031333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 65, 12);
INSERT INTO `table1` VALUES (4, 0x343031333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 66, 13);
INSERT INTO `table1` VALUES (5, 0x353031333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 67, 14);
INSERT INTO `table1` VALUES (6, 0x363031333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 169, 15);
INSERT INTO `table1` VALUES (7, 0x373031333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 69, 16);
INSERT INTO `table1` VALUES (8, 0x383031333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 70, 17);
INSERT INTO `table1` VALUES (9, 0x393031333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a3132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0, 170, 18);

INSERT INTO `rolledupmw` VALUES (0, 0x4142434445464748494a4b4c4d4e4f505152535455565758595a, 0x30313233343536373839, 0x6162636465666768696a6b6c6d6e6f707172737475767778797a, 0x303132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x303132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (1, 0x4242434445464748494a4b4c4d4e4f505152535455565758595a, 0x31313233343536373839, 0x6262636465666768696a6b6c6d6e6f707172737475767778797a, 0x313132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x313132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (2, 0x4342434445464748494a4b4c4d4e4f505152535455565758595a, 0x32313233343536373839, 0x6362636465666768696a6b6c6d6e6f707172737475767778797a, 0x323132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x323132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (3, 0x4442434445464748494a4b4c4d4e4f505152535455565758595a, 0x33313233343536373839, 0x6462636465666768696a6b6c6d6e6f707172737475767778797a, 0x333132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x333132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (4, 0x4542434445464748494a4b4c4d4e4f505152535455565758595a, 0x34313233343536373839, 0x6562636465666768696a6b6c6d6e6f707172737475767778797a, 0x343132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x343132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (5, 0x4642434445464748494a4b4c4d4e4f505152535455565758595a, 0x35313233343536373839, 0x6662636465666768696a6b6c6d6e6f707172737475767778797a, 0x353132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x353132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (6, 0x4742434445464748494a4b4c4d4e4f505152535455565758595a, 0x36313233343536373839, 0x6762636465666768696a6b6c6d6e6f707172737475767778797a, 0x363132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x363132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (7, 0x4842434445464748494a4b4c4d4e4f505152535455565758595a, 0x37313233343536373839, 0x6862636465666768696a6b6c6d6e6f707172737475767778797a, 0x373132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x373132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (8, 0x4942434445464748494a4b4c4d4e4f505152535455565758595a, 0x38313233343536373839, 0x6962636465666768696a6b6c6d6e6f707172737475767778797a, 0x383132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x383132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);
INSERT INTO `rolledupmw` VALUES (9, 0x5042434445464748494a4b4c4d4e4f505152535455565758595a, 0x39313233343536373839, 0x7062636465666768696a6b6c6d6e6f707172737475767778797a, 0x393132333435363738394142434445464748494a4b4c4d4e4f505152535455565758595a, 0x393132333435363738396162636465666768696a6b6c6d6e6f707172737475767778797a);

-- SELECT t3.tupleid, t3.IngressAS, t3.IngressRTR, t3.IncomingIF, t3.vbdata, t.week1, t.week2 into outfile 'ari1' FROM rolledupmw AS t, 
SELECT t3.tupleid, t3.IngressAS, t3.IngressRTR, t3.IncomingIF, t3.vbdata, t.week1, t.week2 FROM rolledupmw AS t, 
(SELECT tupleid, IngressAS, IngressRTR, IncomingIF, vbdata FROM table1) AS t3 
WHERE t.tupleid = t3.tupleid;

-- SELECT t3.tupleid, t3.vbdata, t.week2, t.week3, t.week4, t.week5 into outfile 'table_VALUES_001' FROM rolledupmw AS t,
SELECT t3.tupleid, t3.vbdata, t.week2, t.week3, t.week4, t.week5 FROM rolledupmw AS t,
 (SELECT tupleid, vbdata FROM
   (SELECT tupleid, vbdata, IngressRTR,  IncomingIF FROM 
      (SELECT tupleid, vbdata, IngressRTR,  IncomingIF FROM table1
WHERE IngressRTR IN (62,63,128,129,169,170,294,295,374,375,388,389,392,686,687,738,739)) t1
WHERE t1.IncomingIF IN (9,10,13,15,17,18,20,57,63,102,115,143,155,162,163,168,169)) t2
WHERE (t2.IncomingIF, t2.IngressRTR) in ((9,295),(10,295),(13,375),(15,169),(17,294),(18,170),(18,294),(20,128),(20,129),(20,374),(20,686),(20,687),(57,392),(63,392),(102,739),(115,738),(143,388),(155,389),(162,63),(163,63),(168,62),(169,62))) AS t3 
WHERE t.tupleid = t3.tupleid;

DROP TABLE `table1`;
DROP TABLE `rolledupmw`;

