从表中选择userName,其中userId = {1,2,3,4,... n} [英] Select userName from Table where userId = {1,2,3,4,...n}
本文介绍了从表中选择userName,其中userId = {1,2,3,4,... n}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以从userId很多的表中获取userName列表,
is there any way to get the list of userName from a table where userId are many,
userId userName
1 abc
2 xyz
3 pqr
请在我希望通过jdbcTemplate
,
String query = "Select userName from table_1 where userId = {1,2,3}";
HashMap<int,String> = jdbcTemplate.queryForMap(sql);
// HashMap - int : userId, String - userName
推荐答案
您可能应该使用
select userName from Table where user_id in (1, 2, 3);
这篇关于从表中选择userName,其中userId = {1,2,3,4,... n}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文