查询
SELECT strftime('%W', [DatumEintrag], 'weekday 1') Woche,
SUM([FOO]), Count(Distinct [DatumEintrag]) as Tage
FROM MainData
Where [BAR] LIKE 'BC%'
Group By Woche
导致出现类似的表
Woche | FOO | Tage
41 | 4218| 3
42 | 5624| 4
43 | 7030| 5
44 | 2812| 2
我如何仅获取Tage> = 4的数据。
SELECT strftime('%W', [DatumEintrag], 'weekday 1') Woche, SUM([FOO]), Count (Distinct [DatumEintrag]) as Tage
FROM MainData
Where [BAR] LIKE 'BC%' AND Tage >= 4
Group By Woche
导致“滥用总计:Count()”
答案 0 :(得分:0)
使用having子句
public void renameFile(ActionEvent actionEvent) {
TextInputDialog dialog = new TextInputDialog("Rename");
dialog.setTitle("Rename");
dialog.setHeaderText("Rename File");
dialog.setContentText("New name");
Optional<String> res = dialog.showAndWait();
if (res.isPresent()) {
try {
Path paths = Paths.get("client_storage/" + ClientListView.getSelectionModel().getSelectedItem());
Files.move(paths, paths.resolveSibling(res.get()));
} catch (IOException e) {
e.printStackTrace();
}
}
}
答案 1 :(得分:0)
一种选择是使用嵌套查询:
SELECT *
FROM(
SELECT strftime('%W', [DatumEintrag], 'weekday 1') Woche,
SUM([FOO]),
Count (Distinct [DatumEintrag]) as Tage
FROM MainData
Where [BAR] LIKE 'BC%' Group By Woche)t
WHERE Tage>=4
答案 2 :(得分:0)
SQLite允许您在having
子句中使用列别名。所以你可以这样写:
select strftime('%W', DatumEintrag, 'weekday 1') as Woche,
sum([FOO]),
count(distinct DatumEintrag) as Tage
from MainData
where [BAR] like 'BC%'
group by Woche
having tage > 4