如何重复classid查询

ziluopao 发布于 2017/01/29 20:05
阅读 211
收藏 0

SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid in (1,7,7,2,5,4,3)

上面的sql中本想重复出现classid = 7的数据,但却没有。
怎么才能实现这种需求呢????

加载中
0
ziluopao
ziluopao

SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid=1 union all
SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid=7 union all
SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid=7 union all
SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid=2 union all
SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid=5 union all
SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid=4 union all
SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid=3;

0
ziluopao
ziluopao

这么写为啥不行呢SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid IN (exists(1, 7, 7, 2, 5, 4, 3))

0
G
GLKWT
SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid in (1,,7,2,5,4,3) union all SELECT wz_enewsclass.classid, wz_enewsclass.classname, wz_enewsclass.classpath FROM wz_enewsclass WHERE classid ='7' with ur 是这意思不?
0
ziluopao
ziluopao

已经解决了,不是你说的这样

G
GLKWT
你怎么搞的?
返回顶部
顶部