Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3331322
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:34:25+00:00 2026-05-17T23:34:25+00:00

I have the following query and it gives me an error :Incorrect syntax near

  • 0

I have the following query and it gives me an error :”Incorrect syntax near the keyword ‘GROUP’.” <-shows me the second GROUP BY statement…Can you tell me why?

SELECTventId
,TargetUser
,TargetDomain
,String05
,Amount
,max(Amount) maximum 
FROM
   (SELECT    EventId
              , TargetUser
              , TargetDomain
             , String05 
FROM  AdtServer.dvAll 
GROUP BY EventId, TargetUser, TargetDomain, String05)

GROUP BY EventId,TargetUser,TargetDomain,String05,Amount //ERROR SHOWS HERE

ORDER BY maximum,TargetUser

If I create view for inner query it works fine(But I don’t want to create a view because if my query is long-running query it gives me time-out).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:34:25+00:00Added an answer on May 17, 2026 at 11:34 pm

    You need to give an alias to your table:

    SELECTventId 
    ,TargetUser 
    ,TargetDomain 
    ,String05 
    ,Amount 
    ,max(Amount) maximum  
    FROM 
       (SELECT    EventId 
                  , TargetUser 
                  , TargetDomain 
                 , String05  
        FROM  AdtServer.dvAll  
        GROUP BY EventId, TargetUser, TargetDomain, String05
        ) x
    GROUP BY EventId,TargetUser,TargetDomain,String05,Amount 
    ORDER BY maximum,TargetUser
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query. but it gives me error in the in clause.
I have the following query which gives me the right results. But it's super
I have following query which take more than a minute to execute, how can
Using Oracle 11g release 2, the following query gives an ORA-01790: expression must have
How can I execute the following query and retrieve a result via prepared statement:
I have following query, but it gives me errors, if anyone could give me
Running the following query in SQL Server Management Studio gives the error below. update
I have following stored procedure code when i execute it gives an error saying
I have the following SQL query I was given, but I am not sure
I have following query and data saved in a MySQL database with a timestamp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.