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

  • Home
  • SEARCH
  • 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 9278511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:23:33+00:00 2026-06-18T17:23:33+00:00

I am trying to write a sql query with grouping and I get the

  • 0

I am trying to write a sql query with grouping and I get the error:- Incorrect syntax near the keyword ‘with’.

The query I am writing is as below:-

SELECT          CONTRACT,  
        PACONTNUMBER,  
        Project Manager ID,  
        Status,  
        Project Type,  
        Project Fee Amount,  
        Forecast Total Cost,  
        Forecast Profit,
        Forecast %,
        Actual Billings,
        Actual Total Cost,
        Current Actual Profit,
        Current %,
        GROUPING(PACONTNUMBER) as PACONTNUMBER,  
        SUM(Project Fee Amount) as Project Fee,
        SUM(Forecast Total Cost) as Forecast Cost,
        SUM(Forecast Profit) as Forecast Profit,
        SUM(Forecast %) as Forecast Percentage,
        SUM(Actual Billings) as Billings Total Actual,
        SUM(Actual Total Cost) as Total Cost Actual
FROM        dbo.vwPAProjects_Summary_New_2
GROUP BY   
        CONTRACT,    
        Project Manager ID,  
        Status,  
        Project Type,  
        Project Fee Amount,  
        Forecast Total Cost,  
        Forecast Profit,
        Forecast %,
        Actual Billings,
        Actual Total Cost,
        Current Actual Profit,
        Current %,
        PACONTNUMBER with rollup 
ORDER BY    GROUPING (PACONTNUMBER)

Can anyone point me in the right direction in trying to get this to work?

Many thanks,

  • 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-06-18T17:23:35+00:00Added an answer on June 18, 2026 at 5:23 pm

    You cannot have spaces in your identifiers. For SQL Server you can surround then in square brakets [x] for example:

    SELECT          
            CONTRACT,  
            PACONTNUMBER,  
            [Project Manager ID],
            Status,  
            [Project Type],  
            .
            .
            SUM([Actual Total Cost]) as [Total Cost Actual]
    FROM        dbo.vwPAProjects_Summary_New_2
    GROUP BY   
            CONTRACT,    
            [Project Manager ID],  
            .
            .
            PACONTNUMBER with rollup 
    ORDER BY    GROUPING (PACONTNUMBER)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a sql query like the example below, however, I
I am trying to write following SQL query using JPA Criteria API SELECT *
I am trying to write a sql query to select multiple states from the
I'm trying to write a complex SQL query but couldn't manage to get a
I'm trying to write an SQL query (using the SELECT function) that will take
I'm trying to write an SQL query that would search within a CSV (or
I am trying to write an SQL query within Visual Studio TableAdapter Query Wizard
I am trying to write an SQL query to retrieve all of a users
I'm trying to write a SQL or ActiveRecord query to answer this question: Of
I have a SQL query that I'm trying to write, but I'm not quite

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.