count

MySQL Query: Displaying counts for many groups with many records

I need to produce a large HTML table with quarterly counts for several (around 50) different groups (jurisdictions). I have a MySQL table with around 16,000 rows which have 'jurisdiction_id' and 'quarter' fields. Unfortunately my client doesn't want the resulting report to be paginated. How would I construct a good MySQL query from which...

jquery recognize in which row iam

i have a table with thousands of rows. there are no ids and so on. within the tds of the rows i have a link calling a fucntion and passing "this" to get the link object. using jquery it is easy to get the the closest tr and table (and so the tables.rows.length) i want to know as easy in wich row i'am?! ok i could do a loop but does e...

c#: a method to count occurrences in a list

Is there a simple way to count the number of occurences of all elements of a list into that same list in C#? Something like this: using System; using System.IO; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Linq; string Occur; List<string> Words = new List<string>(); List<string> Occurrences = new...

jQuery - count number of rows in a table

How do I count the number of tr elements within a table using jquery. Sorry, I sense this might be basic but i've been banging my head against it. I know there is a similar thread, but I just want the total rows. http://stackoverflow.com/questions/613024/count-number-of-table-rows-between-two-specific-rows-with-jquery ...

Django models - self join on both FK in a M2M scenario using QuerySet

Let's take following M2M scenario. I want to get all the colleagues of any given student, and the number of courses both of them attend. (Meaning how many courses the given student has in common with each and any of his colleagues.) class Student(models.Model): pass class Course(models.Model): students = models.ManyToManyField...

[XSLT] Get the total number of nodes and counting nodes

Is it possible to get the total number of XML nodes? Also, how does one do a for-statement with XSLT? ...

Count occurrence of a character in a Python string

What's the simplest way to count the number of occurrences of a character in a string? e.g. count the number of times 'a' appears in 'Mary had a little lamb' ...

c# count number of objects of class type within class method

How can I count the number of objects of a class type within a method of that class? For that matter, how to do it outside of a class without adding the objects to a list? I should have thought of that! Thanks! I'm gonna leave it unanswered for a little while to see if there is a better way, because I agree. I'm just sortv wrapping my h...

Can I count elements using jQuery?

I have a list in a ul that is in an ASP repeater. The list is set to overflow with a scrollbar and to only show 16 lis at a time. Is there a jQuery count function that I can use that would allow me to select every "16th" li and add a specific class to it? Selecting the last one won't work because the 16th div is not the last div since i...

PHP: count uppercase words in string

Hi, is there an easy way to count uppercase words within a string? ...

What is the tried and true way of counting the number of rows returned from PHP `mysql_query` function?

I know about mysql_num_rows ( resource $result ) but I have read somewhere that is it not 100% accurate. I have seen other alternatives that actually gets each row and run a counter but that sounds pretty inefficient. I am interested in seeing what others do to get an accurate and efficient count. ...

Complex (ish) SQL join and count query

Hi, I'm trying to create a simple poll function using php and sql. I have three tables: Questions Which simply contains each question asked question_id | question_text | created_at Answers Which contains each answer for each question question_id | answer_id | answer_text Answered Questions Which records who has voted for each opt...

PHP: Unique visits/hits to specific items using cookies/ip...

Hi, I use a simple MySQL table to count day hits for specific pages/items in a website. Using 'id' column for page/item ids, 'date' for the day of the visits/hits, and 'hits' column for the number of hits. Everytime someone visit the page the value of hits for that specific date is updated to +1. But, the value is updated one more time...

counting duplicate entries in Data base

I want to count the amount of times that a zip code is entered into a database. I'm not sure if I am using the right function or not. Also eventually I need to separate the zip codes by the year they were entered int the data base. I know how to separate the years-I think. What I really need help on is counting duplicate entries Here is ...

Select top distinct results ordered by frequency

My table has two columns: id and name. The data looks like this: id | name ---------- 1 Jeff 2 Sam 3 Carl 4 Sam 5 Carl 6 Jeff 7 Dave 8 Jeff What I want to obtain is this: name | frequency ---------------- Jeff 3 Carl 2 Sam 2 Dave 1 Essentially, I need an SQL query that counts the unique ...

SPARQL Query and distinct count

hi all, i have the following query: SELECT ?tag WHERE { ?r ns9:taggedWithTag ?tagresource. ?tagresource ns9:name ?tag } LIMIT 5000 and the results are: abc abc abc abc abc abc abc abd ads anb I want to get somthing like tag | count ----------------- abc 7 abd 1 ads 1 anb 1 I have tried it with count(*) and count...

How many times program has run? C#

How can I get the number of times a program has previously run in C# without keeping a file and tallying. If it is not possible that way, can it be gotten from the Scheduled Task Manager? To C. Ross: how would this be done in a registry setting? forgive me. . . what is a registry setting? ...

Transform arbitrary SQL SELECT TOP(x) to a SELECT COUNT(*)?

I want to be able to take any arbitrary SELECT TOP(X) query that would normally return a large number of rows (without the X limit) and transform that query into a query that counts how many rows would have been returned without the TOP(X) (i.e. SELECT COUNT(*)). Remember I am asking about an arbitrary query with any number of joins, w...

SQL select and count all items that have occured before

I have a table with rows that symbolize order dates: 2009-05-15 13:31:47.713 2009-05-15 22:09:32.227 2009-05-16 02:38:36.027 2009-05-16 12:06:49.743 2009-05-16 16:20:26.680 2009-05-17 01:36:19.480 2009-05-18 09:44:46.993 2009-05-18 14:06:12.073 2009-05-18 15:25:47.540 2009-05-19 10:28:24.150 I would like have query that returns the ...

translate stored procedure - to Linq2SQL (count, max, group, orderby)

I've two tables (1:N) CREATE TABLE master (idMaster int identity (1,1) not null, TheName varchar( 100) null, constraint pk_master primary key(idMaster) clustered) and - CREATE TABLE lnk (idSlave int not null, idMaster int not null, constraint pk_lnk_master_slave(idSlave) primary key clustered) link between Master.idMaster and ...