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 8464673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:49:22+00:00 2026-06-10T14:49:22+00:00

I have written the below Update Statement, but it shows the error such as

  • 0

I have written the below Update Statement, but it shows the error such as “Incorrect syntax near the keyword ‘GROUP’.”

UPDATE 
       J
SET 
       J.StatusID = CASE WHEN SUM(DUV.VendorDUQuantity) = SUM(RD.InvoiceQuantity) THEN 1 ELSE J.StatusID END
FROM
        PLN_DU_Vendor DUV
    INNER JOIN ENG_Release R ON R.ReleaseID = DUV.ReleaseID
    INNER JOIN ENG_DU_Header H ON H.ReleaseID = R.ReleaseID AND DUV.DUID = H.DUID
    INNER JOIN MKT_JobOrder J ON J.JobOrderID = R.JobOrderID
    INNER JOIN MKT_CustomerOrder CO ON CO.OrderID = J.OrderID
    LEFT JOIN PMT_RFDHeader RH ON RH.JobOrderID = J.JobOrderID
    LEFT JOIN PMT_RFDDetail RD ON RD.RFDID = RH.RFDID AND RD.DUID = DUV.DUID                 
WHERE 
        CO.OrderID = 100
GROUP BY 
        J.JobOrderID

Instead of Update, Select is working perfectly for the above Query. What would be the problem and How to write the Query based on Join and Group By clause.

  • 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-10T14:49:24+00:00Added an answer on June 10, 2026 at 2:49 pm

    You can try putting the group by inside of a subquery, then join by the “JobOrderID”, like this:

    UPDATE J
    SET J.StatusID = A.statusId
    FROM MKT_JobOrder J
    INNER JOIN (
        SELECT J.JobOrderID
            , CASE 
                WHEN SUM(DUV.VendorDUQuantity) = SUM(RD.InvoiceQuantity)
                    THEN 1
                ELSE J.StatusID
                END AS statusId 
        FROM PLN_DU_Vendor DUV
        INNER JOIN ENG_Release R ON R.ReleaseID = DUV.ReleaseID
        INNER JOIN ENG_DU_Header H ON H.ReleaseID = R.ReleaseID
                                   AND DUV.DUID = H.DUID
        INNER JOIN MKT_JobOrder J ON J.JobOrderID = R.JobOrderID
        INNER JOIN MKT_CustomerOrder CO ON CO.OrderID = J.OrderID
        LEFT JOIN PMT_RFDHeader RH ON RH.JobOrderID = J.JobOrderID
        LEFT JOIN PMT_RFDDetail RD ON RD.RFDID = RH.RFDID
                                   AND RD.DUID = DUV.DUID
        WHERE CO.OrderID = 100
        GROUP BY J.JobOrderID
               , J.StatusID
        ) A ON J.JobOrderID = A.JobOrderID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the below update statement to update the StatusID of the PLN_DU_Vendor
This might be a confusing question but I have written below a Directory crawler,
I have written the following code and getting the below error, I believe its
Hi I have written below code function unique(th){ var obj = {}; for(var i
I am trying to fetch wcf service from jquery. I have written below code
I have written a function below: void trans(double x,double y,double theta,double m,double n) {
I have written the batch file below, in order to automate the process of
I have written grammar for a language (sample code below) //this is a procedure
Below I have written a sample program that I have written to learn about
I have written a pgsql function along the lines of what's shown below. How

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.