Greater than two values in subquery
mysql>
mysql>
mysql> CREATE TABLE MATCHES_SPECIAL
-> (MATCHNO INTEGER NOT NULL,
-> TEAMNO INTEGER NOT NULL,
-> EmployeeNO INTEGER NOT NULL,
-> WON SMALLINT NOT NULL,
-> LOST SMALLINT NOT NULL,
-> START_DATE DATE NOT NULL,
-> START_TIME TIME NOT NULL,
-> END_TIME TIME NOT NULL,
-> PRIMARY KEY (MATCHNO));
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> INSERT INTO MATCHES_SPECIAL VALUES (1, 1, 6, 3, 1, '2004-10-25', '14:10:12', '16:50:09');
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO MATCHES_SPECIAL VALUES (2, 1, 44, 3, 2, '2004-10-25', '17:00:00', '17:55:48');
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT MATCHNO
-> FROM MATCHES_SPECIAL
-> WHERE (START_DATE, START_TIME) >
-> (SELECT START_DATE, START_TIME
-> FROM MATCHES_SPECIAL
-> WHERE MATCHNO = 1);
+---------+
| MATCHNO |
+---------+
| 1 |
| 2 |
+---------+
2 rows in set (0.00 sec)
mysql>
mysql> drop table MATCHES_SPECIAL;
Query OK, 0 rows affected (0.00 sec)
mysql>
Related examples in the same category