×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Incorrect syntax near the keyword 'GROUP'

Incorrect syntax near the keyword 'GROUP'

Incorrect syntax near the keyword 'GROUP'

(OP)
Hello,

I have this query:

CODE --> 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?

RE: Incorrect syntax near the keyword 'GROUP'

Would this work?

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;  


---- Andy

There is a great need for a sarcasm font.

RE: Incorrect syntax near the keyword 'GROUP'

(OP)
Yes, it does. Thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close