I have a view that's currently defined as
CREATE VIEW
riders
AS select ridelog
.uid
AS rid
,sum(ridelog
.distance
) AS distance
from ridelog
group by ridelog
.uid
What I'd like to do is add a second field that shows the distance y-t-d. i.e, the sum of the distances for rides that occurred since January 1st of the current year.
The problem is, I can't figure out how to say "current year" in mysql or if I can create a view that has sums with different criteria in them.
Is this possible?