It’s not really hard trouble but as I’m learning language I want my code being sorta elegant and I don’t like this :
match aver with
| 1 -> @" GROUP BY
DATEPART(YEAR, DT.[Date]),
DATEPART(MONTH, DT.[Date]),
DATEPART(DAY, DT.[Date]),
DATEPART(HOUR, DT.[Date]),
(DATEPART(MINUTE, DT.[Date]) / 10)"
| 2 -> @" GROUP BY
DATEPART(YEAR, DT.[Date]),
DATEPART(MONTH, DT.[Date]),
DATEPART(DAY, DT.[Date]),
DATEPART(HOUR, DT.[Date])"
| 3 -> @" GROUP BY
DATEPART(YEAR, DT.[Date]),
DATEPART(MONTH, DT.[Date]),
DATEPART(DAY, DT.[Date])"
| 4 -> @" GROUP BY
DATEPART(YEAR, DT.[Date]),
DATEPART(MONTH, DT.[Date])"
| _ -> @" GROUP BY
DATEPART(YEAR, DT.[Date]),
DATEPART(MONTH, DT.[Date]),
DATEPART(DAY, DT.[Date]),
DATEPART(HOUR, DT.[Date]),
DATEPART(MINUTE, DT.[Date])"
because I really want it alike this :
match aver with
| 4 -> @" GROUP BY
DATEPART(YEAR, DT.[Date]),
DATEPART(MONTH, DT.[Date])"
| 3 -> 2 + @",DATEPART(DAY, DT.[Date])"
| 2 -> 3 + @",DATEPART(HOUR, DT.[Date])"
| 1 -> 3 + @", (DATEPART(MINUTE, DT.[Date]) / 10)"
| _ -> 3 + @", DATEPART(MINUTE, DT.[Date])"
is there some way to use another matchings in some matching ?
Not the most efficient, but it should demonstrate what you’re looking for.