Grouping by Year (1 Viewer)

wgma

Registered User.
Local time
Today, 08:38
Joined
Nov 19, 2007
Messages
72
I have a query that I need to group by the year of a date that is stored as a string , i.e. 20080630.

SELECT WGMAHIST_TIMEDTY.TDYLCL, WGMAHIST_TIMEDTY.TDYTDT, sum(WGMAHIST_TIMEDTY.TDYFND) AS Hrs
FROM WGMAHIST_TIMEDTY
WHERE WGMAHIST_TIMEDTY.TDYSSN=123456789
group by WGMAHIST_TIMEDTY.TDYTDT, WGMAHIST_TIMEDTY.TDYLCL

I know that this can be done but How?

Thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:38
Joined
Aug 30, 2003
Messages
36,139
Try

Left(FieldName, 4)
 

wgma

Registered User.
Local time
Today, 08:38
Joined
Nov 19, 2007
Messages
72
I did that and it threw an error.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:38
Joined
Aug 30, 2003
Messages
36,139
What was the error? Exactly how did you use it? What's the full SQL now?
 

Users who are viewing this thread

Top Bottom