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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:15:08+00:00 2026-05-26T17:15:08+00:00

I have a query like the following one: SELECT case_filed_by, office_code, desg_code, court_code, court_case_no,

  • 0

I have a query like the following one:

  SELECT case_filed_by,
         office_code,
         desg_code, 
         court_code,
         court_case_no,
         COUNT(office_code) as count 
    FROM registration_of_case 
   WHERE TRUE 
     AND SUBSTR(office_code, 1, 0) = SUBSTR('', 1, 0) 
ORDER BY court_code, court_case_no

I am getting the following error:

ERROR: column “registration_of_case.case_filed_by” must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT case_filed_by,office_code,desg_code, court_code,court […]

  • 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-26T17:15:09+00:00Added an answer on May 26, 2026 at 5:15 pm

    As you describe in your comments, you actually want the number of selected rows in a separate field of your result set.

    You can achieve this by using a subselect for the count and the join these two queries.

    Something like this:

      SELECT case_filed_by,
             office_code,
             desg_code, 
             court_code,
             court_case_no,
             office_code_count 
        FROM registration_of_case,
             (SELECT COUNT(office_code) AS office_code_count 
                FROM registration_of_case 
               WHERE TRUE 
                 AND SUBSTR(office_code, 1, 0) = SUBSTR('', 1, 0)
             ) AS count_query
       WHERE TRUE 
         AND SUBSTR(office_code, 1, 0) = SUBSTR('', 1, 0) 
    ORDER BY court_code, court_case_no
    

    I couldn’t test the query, but it should work or at least point you into the right direction.

    • 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: SELECT o.id,o.name FROM object o WHERE ( o.description LIKE
I have a query like this: SELECT t1.id, (SELECT COUNT(t2.id) FROM t2 WHERE t2.id
I have a query like this: SELECT COUNT(*) AS amount FROM daily_individual_tracking WHERE sales
I have a query like the following: Select new mypackage.MyClass( u, max(sc.serviceDate)) from Unit
I have a query like this: SELECT TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE FROM MY_DB.INFORMATION_SCHEMA.COLUMNS WHERE
I have a query like so : SELECT * FROM table WHERE premium =
I have a query like this: SELECT TaFellesVaktjournal.*, TaBygg.ByggNavn FROM TaFellesVaktjournal LEFT JOIN TaBygg
I have the following MySQL query: $imgDimensions_query = SELECT imgWidth, imgHeight FROM ( SELECT
I have code that looks like the following: //unrelated code snipped resolver.reset(new tcp::resolver(iosvc)); tcp::resolver::query
I have the following mysql query which I am running with php like so.

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.