mysql select * from table where id in(1,2,3,3,4) 怎么能显示两次ID=3这一列?

2025-12-04 19:25:20
推荐回答(5个)
回答1:

select * from table where id=1 or id=2 or id=3 or id=4 or id=3

但是,你知道。这样。显示不出来。
不可能实现,我试过了。

回答2:

显示的时候,如果id=3就显示多一次,没必要从取DATA时处理。
要不然,就INSERT多一行ID=3的(这个虽然不合理,但凑合)

回答3:

select * from table where id in(1,2,3,4) union all select * from table where id =3

回答4:

mysql select * from table where id in(1,2,3,3,4) or id=3

回答5:

select Distinct t.* from table t where t.id in(1,2,3,3,4) order by t.id