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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:29:25+00:00 2026-06-02T12:29:25+00:00

SELECT id,icon,type,cnt FROM capability JOIN ( SELECT s0_.capability_id AS capability_id0 , count(capability_id) as cnt

  • 0
SELECT id,icon,type,cnt 
FROM  capability 
JOIN (
    SELECT s0_.capability_id AS capability_id0 ,
           count(capability_id) as cnt  
    FROM service_offer_capability s0_ 
    INNER JOIN service_offer s1_ ON s0_.service_offer_id = s1_.id 
    WHERE s0_.value <> 'i:0;' AND s1_.service_id = 2 
    GROUP BY s0_.capability_id
) af
ON af.capability_id0=id;

All i want to do is to have a max(cnt) as an extra column. I know that you can order by cnt and get the first but i am looking for an alternative..Is it possible or i have to run multiple queries?

  • 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-02T12:29:26+00:00Added an answer on June 2, 2026 at 12:29 pm

    This should do it:

    SELECT id,
           icon,
           type,
           cnt,
           max(cnt) over () as max_cnt
    FROM  capability 
    JOIN (
        SELECT s0_.capability_id AS capability_id0 ,
               count(capability_id) as cnt  
        FROM service_offer_capability s0_ 
        INNER JOIN service_offer s1_ ON s0_.service_offer_id = s1_.id 
        WHERE s0_.value <> 'i:0;' AND s1_.service_id = 2 
        GROUP BY s0_.capability_id
    ) af
    ON af.capability_id0=id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to change the state of a Gtk status icon from a thread
I'm trying to determine the current paper type selection on the default printer using
I am having trouble with a slowly changing dimension type II selection. I am
I am using the following C# to replace the texts 'Edit, Delete and Select'
If you click on the icon resembling a downard-pointing triangle in the PyDev Package
In windows text files are displayed with notepad icon. When we double click the
I am a bit confused about the nth-of-type pseudo class, and how this is
I have a map that has checkboxes for users to select what they would
In my page there are lists like what is given below. <li class=select> <div
I'm building a Drupal module to tie an icon to a particular page using

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.