for-loop - How to select two table columns in the same for loop
问题描述
Im trying to get two variables from the same table in a for loop, so far the first one works but when i try to do the second one it gives me me an error, i dont understand why its wrong?
The uncommented code works just fine, but the commented code gives me errores, they are the same except for the column im selecting from.
List<Events> eventlist = SQLite.select().from(Events.class).queryList();
int size = eventlist.size();
System.out.println(eventlist.size());
int id = 1;
for (int i = 0; i < size; i++) {
System.out.println(i);
System.out.println("id " + id);
String st = valueOf(SQLite.select(Events_Table.init_date)
.from(Events.class).where(Events_Table.id.eq(id)).querySingle());
//ERROR HERE
//String ed = valueOf(SQLite.select(Events_Table.end_date)
.from(Events.class).where(Events_Table.id.eq(id)).querySingle());
String start = funt.formatDate(st);
//String end = funt.formatDate(ed);
System.out.println("Stdate: " + start);
//System.out.println("edDate: " + end);
//singleE.add(start);
id++;
}
this is the current output
System.out: 309
System.out: id 310
System.out: Stdate: 2018-01-12
i would like the same but with the edDate, both at the same time
解决方案
推荐阅读
- eclipse - Eclipse:加载 SSH2 私钥时出错
- node.js - 从 Node.js 中的 .rar 或 .zip 文件中提取所有文件名
- php - centos7:从 php (sudo) 运行 .sh 脚本
- javascript - Vue中的分页JSON应用程序:如何将类添加到当前页面项?
- javascript - ThreeJs Object 轻松看鼠标
- terraform - 在 Terraform 中,当 EMR 集群资源的引导操作内容发生变化时,我可以重新创建它吗?
- visual-studio - UWP PWA:子域作为起始页
- go - 如何从地图中获取密钥
- reactjs - reactjs 在状态中设置了错误的值
- python - 在 Windows 中使用 pexpect.popen_spawn.PopenSpawn() 运行 telnet 实例