count

Best way to send PHP script usage statistics to an external script

I'm writing an application in PHP which I plan to sell copies of. If you need to know, it's used to allow users to download files using expiring download links. I would like to know whenever one of my sold applications generates a download. What would be the best way to send a notice to my php application on my server, which simply tel...

Error when comparing values in Oracle

I write simple procedure. DECLARE connection_id LINE.CONNECTION_ID%TYPE := 11009; tmp_integer INTEGER; BEGIN SELECT COUNT(*) INTO tmp_integer FROM LINE WHERE LINE.CONNECTION_ID = 11009; DBMS_OUTPUT.PUT_LINE(connection_id); DBMS_OUTPUT.PUT_LINE(tmp_integer); END; Result of the launch: 11009 3 It is good result. I have only...

SQL: count number of distinct values in every column

I need a query that will return a table where each column is the count of distinct values in the columns of another table. I know how to count the distinct values in one column: select count(distinct columnA) from table1; I suppose that I could just make this a really long select clause: select count(distinct columnA), count(distinct...

Select Count Distinct

I would like to count the number of installations of each Member in a table similar to this. But this count distinct drives me nuts... MemberID | InstallDate 1 | Yesterday 2 | Today 1 | Today 3 | Today The above table should produce something like this one.. MemberID | CountNumberOfInstallations 1 | 2 2 | 1 3 | 1 p.s. I know...

Django: retrieve all galleries containing one public photo at least

Hi (please, excuse me for my ugly english) ! Imagine these very simple models : class Photo(models.Model): is_public = models.BooleanField('Public', default=False) class Gallery(models.Model): photos = models.ManyToManyField('Photos', related_name='galleries', null=True, blank=True) I need to select all Gallery instances whi...

Count columns in a HTML table with php

Hay Guys, i have a basic string with holds a html table. The table looks like this: <TR> <TD>asdf, dfg</TD><TD>0915</TD><TD>0945</TD><TD></TD><TD>15</TD><TD>45</TD><TD></TD><TD>1315</TD> </TR> <TR> <TD>asdf, dfg</TD><TD>0915</TD><TD>0945</TD><TD></TD><TD>15</TD><TD>45</TD><TD></TD><TD>1315</TD> </TR> <TR> <TD>asdf, dfg</TD>...

Need help adding a conditional COUNT() to a query already using JOINs

Here's what I need to fetch: - posts that have comments - number of comments per post - number of unread comments per post (expressed by a bool "read" column in the "comments" table) The last part is what I'm having trouble with. Here's my SQL so far: SELECT posts.id , posts.title , COUNT(comments.id) AS commentsCo...

How do we count rows using Hibernate?

For example, if we have a table Books, how would we count total number of book records with hibernate? Thanks ...

Simple SQL - count function

My MySQL table is simple. I have 3 fields: an index a url a title making up 20 records. I'm trying to count the number of rows so that I can paginate with PHP. But count(*) is returning more than the number of rows that are there, 142 total. I get the same results counting the index. What am I missing? edit Sorry for the previous...

Reliable Way to get Unique Hits to an Article

Hello, I am using asp.net C# and looking for a reliable way to get genuine unique human hits to articles. My goal is to not count a hit if its a bot or non human visit. Anyone, that is blocking cookies or don't have cookies activated the hit should not count. I am afraid that someone may try to rig hits on an article by sending a bunch ...

Using SetParameterList and the LIKE keyword

I'm using NHibernate and I have a query which I want to run, which involves returning the whole table plus a count and group by. From what I've read online you can't do this with NHibernate Criteria. To get round this, I'm using a named query: SELECT id, COUNT(id) AS myCount FROM foo INNER JOIN bah ON foo.id = bah.fooId...

Cannot .Count() on IQueryable (NHibernate)

Hello, I'm with an irritating problem. It might be something stupid, but I couldn't find out. I'm using Linq to NHibernate, and I would like to count how many items are there in a repository. Here is a very simplified definition of my repository, with the code that matters: public class Repository { private ISession session; /*...

How to count total photos on iphone

I am trying to count total photos on the iphone and get the total filesize. What is the best way? ...

Count() using Where clause and Left Join

I have a query similar to the following: SELECT users.id FROM users LEFT JOIN sales ON installations.customer = users.id What I would like to say is something like "WHERE count(sales.id) > 4" - meaning that if the user has more than 4 sales assoc with them. I am not sure if I am going about this the wrong way or not though ...

Count occurances in string from keyword array in javascript

I have an array: var locations = ['Afghanistan','Albania','Algeria','New York']; and a string: var string = 'I love Afghanistan New York Afghanistan Andorra Andorra Algeria New York'; I want to count the number of times each keyword in the array appears in the string but can't figure out the best way to do that. ...

How to sort by count with postgresql?

I have two tables: Companies: (id, name, city) Workers: (id, name) I would like to get all companies and sort them by numbers of employes. The result should give: count | company id | company name | city ------------------------------------------ 90 6 foo corp NY 45 9 bar corp LA 0 ...

How to sort by custom count with postgresql?

I have two tables: Companies: (id, name) Workers: (id, name, country) I would like to get all companies and sort them by numbers of employees from a given country. For a query looking for companies that have more workers from the USA, the result should give: #workers from USA | company id | company name ----------------------------...

How can I make the Count function return 0?

I am trying to create a series of queries in Access that count the number of clients of each ethnicity in each of 77 counties. Here is SQL code for one of my queries that I'm trying to do this for... SELECT [ClientsByCounty-Asian].County, [ClientsByCounty-Asian].CountyName, Count([ClientsByCounty-Asian].Asian) AS CountOfAsian FROM [Cl...

SQL: COUNT() with items appearing multiple times in one-to-many relationship? Alternative to GROUP BY?

I have a query listing product categories, by supercategory > category. The query counts the number of products in each category (COUNT(ptc.catid)). Howewer: the query doesn't let a category appear twice (a category can be linked to multiple supercategories). How can this be re-written so categories (c.title) can be listed under multip...

MS ACCESS: How can i count distinct value using access query?

here is the current complex query given below. SELECT DISTINCT Evaluation.ETCode, Training.TTitle, Training.Tcomponent, Training.TImpliment_Partner, Training.TVenue, Training.TStartDate, Training.TEndDate, Evaluation.EDate, Answer.QCode, Answer.Answer, Count(Answer.Answer) AS [Count], Questions.SL, Questions.Question FROM ((Evaluation I...