日期:2014-05-16 浏览次数:20698 次
CREATE TABLE old_temp_order (userid VARCHAR2(20) PRIMARY KEY,username VARCHAR2(20));
INSERT INTO OLD_TEMP_ORDER (USERID, USERNAME) VALUES ('10120110514051', '第一'); INSERT INTO OLD_TEMP_ORDER (USERID, USERNAME) VALUES ('10120110514052', '第二'); INSERT INTO OLD_TEMP_ORDER (USERID, USERNAME) VALUES ('10120110514053', '第三');
10120110514053 第三 10120110514052 第二 10120110514051 第一
SELECT USERID, USERNAME FROM OLD_TEMP_ORDER WHERE USERID = '10120110514053' UNION ALL SELECT USERID, USERNAME FROM OLD_TEMP_ORDER WHERE USERID = '10120110514052' UNION ALL SELECT USERID, USERNAME FROM OLD_TEMP_ORDER WHERE USERID = '10120110514051'
SELECT * FROM OLD_TEMP_ORDER WHERE USERID IN ('10120110514053', '10120110514052', '10120110514051');