About 304,000 results
Open links in new tab
  1. How to count occurrences of a column value efficiently in SQL?

    In the second query, there's embedded group-by that potentially greatly reduces the number of rows. Try adding DISTINCT to the first query: "select DISTINCT id, age, count (*) over …

  2. How can I get multiple counts with one SQL query?

    Note that as an alternative to distinct, as I have made the correction, you can also/better use group by with the benefit of replacing an entire nested query with a simple count(*) as @Mihai …

  3. sql - Select count (*) from multiple tables - Stack Overflow

    36 My experience is with SQL Server, but could you do: select (select count(*) from table1) as count1, (select count(*) from table2) as count2 In SQL Server I get the result you are after.

  4. sql - Is it possible to specify condition in Count ()? - Stack Overflow

    Is it possible to specify a condition in Count()? I would like to count only the rows that have, for example, "Manager" in the Position column. I want to do it in the count statement, not using WH...

  5. Multiple COUNT() for multiple conditions in one query (MySQL)

    Mar 9, 2015 · Multiple COUNT () for multiple conditions in one query (MySQL) Asked 12 years ago Modified 3 years ago Viewed 125k times

  6. SUM of grouped COUNT in SQL Query - Stack Overflow

    Oct 17, 2012 · I am using SQL server and the following should work for you: select cast (name as varchar (16)) as 'Name', count (name) as 'Count' from Table1 group by Name union all select …

  7. sql - Selecting COUNT (*) with DISTINCT - Stack Overflow

    I needed to get the number of occurrences of each distinct value. The column contained Region info. The simple SQL query I ended up with was: SELECT Region, count(*) FROM item …

  8. sql - How to use count and group by at the same select statement ...

    Apr 27, 2010 · I have an SQL SELECT query that also uses a GROUP BY, I want to count all the records after the GROUP BY clause filtered the resultset. Is there any way to do this directly …

  9. sql - Fastest way to count exact number of rows in a very large …

    May 20, 2011 · I was trying to count the no. of rows in a SQL Server table using MS SQL Server Management Studio and ran into some overflow error, then I used the below : select count_big …

  10. sql server - SQL count rows in a table - Stack Overflow

    Mar 7, 2015 · I need to send a SQL query to a database that tells me how many rows there are in a table. I could get all the rows in the table with a SELECT and then count them, but I don't like …