Spring JDBC - select where in ()

    
String sql4 = "select distinct UGCID from UGCListFor480 where UserURI =? and CreateTime < ?";  
    List<String> ugcidList = jdbcTemplate.queryForList(sql4, new Object[]{uri, createTime}, String.class);  
    NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);  
    MapSqlParameterSource parameters = new MapSqlParameterSource();  
    parameters.addValue("ugcidList", ugcidList);  
    // get link list  
    List<String> linkResults = namedParameterJdbcTemplate.queryForList(  
      "select ExpandedURL from UGCListFor480URL where ExpandedURL <> 'shouldBeDeleted' "  
       + " and UGCID in (:ugcidList) group by UGCID",   
      parameters, String.class );  

No comments:

Post a Comment