count

How to get total result count in paged result views?

Hi, I have a DB table with approx. 100,000 entries. My web app will show paged results of search queries, which may yield between 0 and 100,000 records. When generating the output I want to do two things: Show total nr of results Show paged view, with 50-100 results per page. Obviously I would like to query records for just one pag...

count of entries in data frame in R

I'm looking to get a count for the following data frame: > Santa Believe Age Gender Presents Behaviour 1 FALSE 9 male 25 naughty 2 TRUE 5 male 20 nice 3 TRUE 4 female 30 nice 4 TRUE 4 male 34 naughty of the number of children who believe. What command would I use to...

MySQL: how to get records with count > 1?

I have a sql like this: SELECT *, count(*) as cc FROM manytomany GROUP BY aid, bid ORDER BY cc DESC which return all records with the count #. however, what can I do if I only want to get the ones with count > 1? ...

Preg matching and counting the resulting match in a short string

I already have a function that counts the number of items in a string ($paragraph) and tells me how many characters the result is, ie tsp and tbsp present is 7, I can use this to work out the percentage of that string is. I need to reinforce this with preg_match because 10tsp should count as 5. $characters = strlen($paragraph); $items ...

Differences case sensitivity in SELECT COLUMN and COUNT, mysql?

Okay, I am abit confusing here. In my database I have 5 rows of this data => "[email protected]" (all lower case), and This is my code, Query 1 (I am using php and mysql): $str = '[email protected]'; $sel = mysql_query("SELECT COUNT(*) FROM table WHERE `column` = '{$str}'"); $num = mysql_num_ro...

How to get method count in a type (interface/class/enum) in Eclipse?

I want to know how many methods an interface declares or a class/enum implements. How to get that in Eclipse? ...

How to operate this query by puting mentioned condition?

My table is as follows ID Name 1 Amit 2 Shalu 2 Ram 3 John 3 Kripa 3 Manish 3 Abhi 1 Ayush My requirement is to generate a query that will make the format as ID Name 1 Amit OR Ayush 2 Shalu OR Ram 3 John AND Kripa AND Manish AND Abhi Conditions: when count(Id)=2 concatenate OR with Names when count(Id)>3 con...

SQL Count, counting Halfs!

I have a rather strange problem: when certain sales are made (completed) a record is inserted with the event and ID of the sales person, currently this table is queried and the 'Count' is used (along with usual date boundaries) to calculate number of 'closed' sales. This is currently working fine. The problem now is some sales are 'sha...

Faster alternative in Oracle to SELECT COUNT(*) FROM sometable

I've notice that in Oracle, the query SELECT COUNT(*) FROM sometable; is very slow for large tables. It seems like the database it actually going through every row and incrementing a counter one at a time. I would think that there would be a counter somewhere in the table how many rows that table has. So if I want to check the numb...

MySQL query speed issues when counting from second table

So I'm having serious speed problems using a left join to count ticket comments from another table. I've tried using a sub-select in the count field and had precisely the same performance. With the count, the query takes about 1 second on maybe 30 tickets, and 5 seconds for 19000 tickets (I have both a production and a development serve...

Calculate most common values

If i have a matrix A with n values spanning from 65:90. How do i get the 10 most common values in A? I want the result to be a 10x2 matrix B with the 10 common values in the first column and the times it appears in the second column. ...

Insert Group By count results into a table

How do you insert a group by count result into a table? I'm trying to insert a list of names with counts for each. Thanks!! ...

MySQL: get records from database and add a COUNT() column to the rows

I'm trying to retrieve books from one table and left join the chapters table. What I need from the second table is just the COUNT() of chapters available for those books and add that value as an extra column called chapters (or something else). My current try looks like this: SELECT b.*, count(c.chapter_nr) as chapters FROM books as b l...

Histogram generating function

i was assigned to make some changes to a C program written by someone else...i want to understand it first to work on it properly...i came upon a function that generates the histogram of ASCII values from a given long string of data. it is something like this. //load the symbols the old data for(int k = 0;k < 256;++k) { sym[k].S...

select count and other recors in one single query

i have the following query select main_cat_name,cat_url from mf_main order by main_cat_name this returns whole data of my table.Now i want to have count of the total rows of this table.I can do it using another query but how can i use them in one single query??? i want two data ONE :- the rows of the table TWO:- the count how can i ha...

Returning Multiple Counts of Rows

Hard to capture the problem in a single sentence, but the problem is a simple one. Table looks like this: col_a col_b v1 c v2 c v3 c v5 d v2 d v1 a v5 a v7 a v4 a Each row is distinct, and I need a count of the rows for each unique value of col_b. So, my resu...

Counting how often which mnemonic occures

Do you know a program which gives you a list of all assembler mnemonics used by a given byte machine code (mainly for x86's) beside their number of occurrences? I don't mean something like a pure disassembler. I'm only interested in their absolute frequencies. Edit: I'm happy too with a simple shell script or a cunning sequence of well ...

jquery - count divs with ids in an array?

Not sure how to do this with jquery, but I'm trying to return a count of the number of divs that have specific classes... <div id="main"> <div class="contact">Data</div> <div class="margin">Margin</div> <div class="contact">Data</div> <div class="break">Break</div> <div class="break">Breaker</div> <div class="nap">Nap</div> </div> A...

MySql count table rows

Hello Stackoverflowers, I'm a MySQL beginner. Does anybody know what the sql statment is to read how many recods their are in a MySql database? I don't want to display the records i just want to know how many records their are in my table. Thanks DJ ...

SQL Query :Filter help needed

I have 2 tables.One is OrderMaster and second is OrderDetails.Both are connected via OrderId Order table fields : OrderId(Primary Key),Total,OrderDate OrderDetail fields : OrderDetailId,ItemId,SupplierId,Amount,OrderId (ForiegnKey) One order can have multiple orderdetail records which can be from various suppliers Now i want to get O...