How to count more than one time with different conditions?Select when group by contains more than one row...

Does Windows 10's telemetry include sending *.doc files if Word crashed?

Strange Sign on Lab Door

Jumping Numbers

What does Cypher mean when he says Neo is "gonna pop"?

Why doesn't "auto ch = unsigned char{'p'}" compile under C++ 17?

Can you combine War Caster, whip, and Warlock Features to Eldritch Blast enemies with reach?

If I delete my router's history can my ISP still provide it to my parents?

Avoiding morning and evening handshakes

What is the purpose of easy combat scenarios that don't need resource expenditure?

Can a dragon be stuck looking like a human?

It took me a lot of time to make this, pls like. (YouTube Comments #1)

Is a debit card dangerous for an account with low balance and no overdraft protection?

How to deal with an incendiary email that was recalled

We are very unlucky in my court

Compress command output by piping to bzip2

How do I say "Brexit" in Latin?

What is this metal M-shaped device for?

Difference between two quite-similar Terminal commands

How can animals be objects of ethics without being subjects as well?

How do you funnel food off a cutting board?

Every character has a name - does this lead to too many named characters?

Why do members of Congress in committee hearings ask witnesses the same question multiple times?

Would these multi-classing house rules cause unintended problems?

What makes the Forgotten Realms "forgotten"?



How to count more than one time with different conditions?


Select when group by contains more than one row with the same value?how can we merge sum and count?MySQL: Delete all rows older than 30 days, but only if count more than oneGroup COUNT by month less than variableSelect only one duplicate with different time columnHow to select random row with count()MySQL group by multiple columns on multiple tables only one result per groupHow to group a few row values together to put into a new table?How to write group by and having in a relational algebra interpreter?how to count distinct value per day with start time and end time













0















Having a table like this:



Example table



I want to get a result like this:



Result



Something like:



SELECT ParentId, COUNT(SomeValue = 1) [CountMin], COUNT(SomeValue > 1) [CountRest]
FROM MyTable
GROUP BY ParentId








share



























    0















    Having a table like this:



    Example table



    I want to get a result like this:



    Result



    Something like:



    SELECT ParentId, COUNT(SomeValue = 1) [CountMin], COUNT(SomeValue > 1) [CountRest]
    FROM MyTable
    GROUP BY ParentId








    share

























      0












      0








      0








      Having a table like this:



      Example table



      I want to get a result like this:



      Result



      Something like:



      SELECT ParentId, COUNT(SomeValue = 1) [CountMin], COUNT(SomeValue > 1) [CountRest]
      FROM MyTable
      GROUP BY ParentId








      share














      Having a table like this:



      Example table



      I want to get a result like this:



      Result



      Something like:



      SELECT ParentId, COUNT(SomeValue = 1) [CountMin], COUNT(SomeValue > 1) [CountRest]
      FROM MyTable
      GROUP BY ParentId






      sql-server sql-server-2016 query group-by





      share












      share










      share



      share










      asked 4 mins ago









      Erick Asto OblitasErick Asto Oblitas

      11614




      11614






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f231106%2fhow-to-count-more-than-one-time-with-different-conditions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f231106%2fhow-to-count-more-than-one-time-with-different-conditions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Parapolítica Índice Antecedentes El escándalo Proceso judicial Consecuencias Véase...

          How to remove border from elements in the last row?Targeting flex items on the last rowHow to vertically wrap...

          Tecnologías entrañables Índice Antecedentes Desarrollo Tecnologías Entrañables en la...