Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incorrect syntax near the keyword 'GROUP' 1

Status
Not open for further replies.

JoPaBC

Technical User
Sep 26, 2017
85
CA
Hello,

I have this query:

SQL:
SELECT [TIME_T].[TIME_F_EMP_NUM] AS EMP_ID, [TIME_T].[TIME_F_DIV_NUM] AS DIVISION, [EE_T].[EE_F_SUR] AS LAST_NAME, [EE_T].[EE_F_FIRST] AS FIRST_NAME, Sum([TIME_T].[TIME_F_AMOUNT]) AS EARNED, Sum([TIME_T].[TIME_F_AMOUNT])*0.04 AS VACPAY
FROM TIME_T, EE_T
WHERE (((Left([TIME_F_PAY_PERIOD],4))=2019 And (([TIME_T].[TIME_F_DIV_NUM])=2) And (([TIME_T].[TIME_F_PAY_CODE])<499 And ([TIME_T].[TIME_F_PAY_CODE])<>303) And (([TIME_T].[TIME_F_EMP_NUM])=[EE_T].[EE_FP_EMP_NUM]))
GROUP BY [TIME_T].[TIME_F_EMP_NUM], 
[TIME_T].[TIME_F_DIV_NUM], 
[EE_T].[EE_F_SUR], 
[EE_T].[EE_F_FIRST]
ORDER BY [EE_T].[EE_F_SUR];

it runs OK in MS Access, but it gives me the error message 'Incorrect syntax near the keyword 'GROUP'' in SQL Express.
Any help, please?
 
Would this work?

[pre]
SELECT T.TIME_F_EMP_NUM AS EMP_ID,
T.TIME_F_DIV_NUM AS DIVISION,
E.EE_F_SUR AS LAST_NAME,
E.EE_F_FIRST AS FIRST_NAME,
Sum(T.TIME_F_AMOUNT) AS EARNED,
Sum(T.TIME_F_AMOUNT) * 0.04 AS VACPAY
FROM TIME_T T, EE_T E
WHERE T.TIME_F_EMP_NUM = E.EE_FP_EMP_NUM
And Left(TIME_F_PAY_PERIOD, 4) = 2019
And T.TIME_F_DIV_NUM = 2
And (T.TIME_F_PAY_CODE < 499 And T.TIME_F_PAY_CODE <> 303)
GROUP BY T.TIME_F_EMP_NUM,
T.TIME_F_DIV_NUM,
E.EE_F_SUR,
E.EE_F_FIRST
ORDER BY E.EE_F_SUR; [/pre]


---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top