数据库管理员为我的asp.net项目发送了sql命令。但对我来说这很难理解。
命令:
SELECT to_char(FirstDate, 'yyyymmdd') AS EXPR1, SUM(Single) AS SingleFile, SUM(Sum) AS AllFiles ROUND(SUM(SingleSize) / (1024 * 1024 * 1024), 2) AS SingleSize,
ROUND(SUM(SumSize)/(1024 * 1024 * 1024), 2) AS SumSize
FROM (SELECT FILE, MIN(DATE) AS FirstDate, 1 AS Single, COUNT(*) AS Sum, MAX(Size) AS SingleSize, SUM(Size) AS SumSize
FROM INETISLE.XFERLOG
GROUP BY FILE) derivedtbl_1
GROUP BY to char(FirstDate,'yyyymmdd')
ORDER BY 1
输出如下:
EXPR1 SingleFile SumFile SingleSize SumSize
19.11.2014 123123 13423 12312423 23424132
我需要将EXPR1(日期)链接到我的日历。
Asp.net日历控件添加如下:
WHERE ([EXPR1] = ?)
我在哪里将这个WHERE放在我的复杂sql命令上?
我需要选择我在日历上选择的一天。
答案 0 :(得分:1)
SELECT to_char(IlkTarih, 'yyyymmdd') AS EXPR1, SUM(Toplam) AS ToplamDosya, ROUND(SUM(TekilBoyut) / (1024 * 1024 * 1024), 2) AS TekilBoyut,
ROUND(SUM(ToplamBoyut)/(1024 * 1024 * 1024), 2) AS ToplamBoyut
FROM (SELECT DOSYA, MIN(TARIH) AS IlkTarih, 1 AS Tekil, COUNT(*) AS Toplam, MAX(BOYUT) AS TekilBoyut, SUM(BOYUT) AS ToplamBoyut
FROM INETISLE.XFERLOG
WHERE DATE(TARIH) = ?
GROUP BY DOSYA) derivedtbl_1
GROUP BY to char(IlkTarih,'yyyymmdd')
ORDER BY 1