dim Symbol_Val as string
我根据我在symbol_val
中的订单输入股票例如
Symbol val="stock1,stock2,stock3,stock4,stock5,stock6,stock7,stock8,stock9"
然后我执行查询
"Select Symbol, trade_date , sec_close,volume from stockPrice WHERE symbol in (" & Symbol_Val & ") and NO_OF_RECORDS= (SELECT max(no_of_records) FROM stockPrice_Alert) ORDER BY" & Symbol_Val
当我执行查询时,我没有按照我的偏好获取记录 任何人都可以告诉我在SQL中需要执行什么查询?
答案 0 :(得分:1)
一种方法是使用public abstract class Base {
@Autowired
ApplicationContext applicationContext;
private Map<String, Base> baseTypes = new HashMap<String, Base>();
@PostConstruct
void initTypes() {
baseTypes.put("typeA", applicationContext.getBean(TypeA.class));
}
public String sayHelloFrom(String type) {
BaseType type = baseTypes.get(type);
return type.sayHello();
}
protected abstract String sayHello();
}
@Component("typeA")
public class TypeA extends Base {
@Override
public String sayHello() {
return "Hello from A";
}
}
来查找值。一种简单的方法是:
charindex()
最好考虑分隔符:
Select Symbol, trade_date, sec_close, volume
from stockPrice
where symbol in (" & Symbol_Val & ") and NO_OF_RECORDS = (SELECT max(no_of_records) FROM stockPrice_Alert)
order by charindex(Symbol_Val, val)