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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:32:39+00:00 2026-06-10T17:32:39+00:00

Below is an sql statement and an error I’m receiving. I have included all

  • 0

Below is an sql statement and an error I’m receiving. I have included all the possible fields from both tables, what is wrong? I want to group all returned items by the prodID

Column ‘orders.adminStatus’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

 SELECT TOP 20 
         ADMINSTATUS,   CURRENCY,   CUSTOMERID,     CUSTOMERMESSAGE,    DELTIME,    DELTOTAL,   DISCOUNT,   DISCOUNTCODE,   
         IP,    ITEMDES,    OPTIONS,    ORDEREDID,  ORDERTOTAL,
         oi.ORDER_ID,   o.ORDER_ID,     PAYMENTTYPE,    PPRICE,     PRODID,     QTY,    REASON,     SECURITYKEY,    SHIPADDRESS1,   
         SHIPADDRESS2,  SHIPADDRESS3,   SHIPCITY,   SHIPCOMPANY,    
         SHIPCOUNTRY,   SHIPCOUNTY,     SHIPMETHOD,
         SHIPNAME,  SHIPPOSTCODE,   STATUS,     STOCKCODE,  SUBTOTAL,   TAX,    TAXABLE,    TIMEDATE,   TXAUTHNO,   VENDORTXCODE,   VPSTXID
         FROM orderedItems oi
         left join orders o on  oi.order_id = o.order_id


    Group by PRODID
  • 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-10T17:32:41+00:00Added an answer on June 10, 2026 at 5:32 pm

    If you are selecting separate columns, they ALL need to appear in the GROUP BY clause unless they are aggregate functions.

    See here: http://msdn.microsoft.com/en-us/library/ms177673.aspx

    e.g.

    SELECT TOP 20 
             ADMINSTATUS,   CURRENCY,   CUSTOMERID,     CUSTOMERMESSAGE,    DELTIME,    DELTOTAL,   DISCOUNT,   DISCOUNTCODE,   
             IP,    ITEMDES,    OPTIONS,    ORDEREDID,  ORDERTOTAL,
             oi.ORDER_ID,   o.ORDER_ID,     PAYMENTTYPE,    PPRICE,     PRODID,     QTY,    REASON,     SECURITYKEY,    SHIPADDRESS1,   
             SHIPADDRESS2,  SHIPADDRESS3,   SHIPCITY,   SHIPCOMPANY,    
             SHIPCOUNTRY,   SHIPCOUNTY,     SHIPMETHOD,
             SHIPNAME,  SHIPPOSTCODE,   STATUS,     STOCKCODE,  SUBTOTAL,   TAX,    TAXABLE,    TIMEDATE,   TXAUTHNO,   VENDORTXCODE,   VPSTXID
             FROM orderedItems oi
             left join orders o on  oi.order_id = o.order_id
    
    
        Group by ADMINSTATUS,   CURRENCY,   CUSTOMERID,     CUSTOMERMESSAGE,    DELTIME,    DELTOTAL,   DISCOUNT,   DISCOUNTCODE,   
             IP,    ITEMDES,    OPTIONS,    ORDEREDID,  ORDERTOTAL,
             oi.ORDER_ID,   o.ORDER_ID,     PAYMENTTYPE,    PPRICE,     PRODID,     QTY,    REASON,     SECURITYKEY,    SHIPADDRESS1,   
             SHIPADDRESS2,  SHIPADDRESS3,   SHIPCITY,   SHIPCOMPANY,    
             SHIPCOUNTRY,   SHIPCOUNTY,     SHIPMETHOD,
             SHIPNAME,  SHIPPOSTCODE,   STATUS,     STOCKCODE,  SUBTOTAL,   TAX,    TAXABLE,    TIMEDATE,   TXAUTHNO,   VENDORTXCODE,   VPSTXID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to read the below SQL statement from one properties. update scoreconfig set
I seem to have an error in my sql statement below $mysql = mysql_query(
In the below sql statement i get the following error Cannot use an aggregate
I'm getting the error below for this SQL statement in VB.Net 'Fill in the
I'm trying to do the below sql statement in GORM select * from table1
I want to write an SQL statement like below: select * from tbl where
I have a problem with the SQL statement detailed below. The query returns the
I have issued the SQL statement below : SELECT GATNR ,GITNO ,GBANO ,MAX (CASE
I'm getting the following error when I try to execute the sql statement below
How to raise error from PostgreSQL SQL statement if some condition is met? I

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.