count

How to get count number of SelectedNode with XPath in C#?

Hi, I am using HTMLAgilityPack in my application, and i want to get the item(node) count of SelectedNodes as the code below: HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(webBrowser1.DocumentText); var tagListe = doc.DocumentNode.SelectNodes("//a[@href]"); var divListe = doc.DocumentNode.SelectNodes...

Count of a column with different rows

I want to join two tables (below) which i get. But then I want to do a count to see how many times each job_category is shown when contactId > 0 Any Help would be appreciated! Tablel : | JobPositionId | JobPositionName | JobDescriptionId | JobCategoryId | ContactId ----------------------------------------------------------------------...

Array.count works fine locally but breaks on heroku

Right now, if I go to the index action of a model that I have, I don't show the basic table of data that rails generates for me if there are no existing records in the database. I do something like: <% if @my_records.count > 0 %> <table> <tr> <th>...</th> <th>...</th> <th>...</th> <th>etc</th> </tr> <% @my_records....

Quick NSArray Question - count

Hello! Does nsarray count return the NUMBER of objects (I.E. the first object would be 1, etc) or does it return the max index of the object (I.E. the first one would be 0); Thanks, Christian Stewart ...

return count 0 with mysql group by

database table like this ============================ = suburb_id | value = 1 | 2 = 1 | 3 = 2 | 4 = 3 | 5 query is SELECT COUNT(suburb_id) AS total, suburb_id FROM suburbs where suburb_id IN (1,2,3,4) GROUP BY suburb_id however, while I run this query, it doesn't give CO...

What does dt.rows.count==0 actually mean?

What does dt.rows.count==0 actually mean? can anybody help me... i want the explanation for the following code.. I used this code for saving & updating a row protected void Button1_Click(object sender, EventArgs e) { //create the database connection //create the command object and store the sql query ...

What's the best T-SQL syntax to filter for an ID that has a count of X or at least X or at most X in a joined table?

What's the best way to do something like this in T-SQL? SELECT DISTINCT ID FROM Members, INNER JOIN Comments ON Members.MemberId = Comments.MemberId WHERE COUNT(Comments.CommentId) > 100 Trying to get the members who have commented more than 100 times. This is obviously invalid code but what's the best way to write this? ...

Counting Word Frequency (most significant words) in a String, excluding keywords

I would like to count the frequency of words (excluding some keywords) in a string and sort them DESC. So, how can i do it? In the following string... This is stackoverflow. I repeat stackoverflow. Where the excluding keywords are ExKeywords() ={"i","is"} the output should be like stackoverflow repeat this ...

Group By and Count using nHibernate

Imagine the following tables : Tag (TagId, Label) Post (PostId, Title, Content) User (UserId, Name) UserPostTag (Id, UserId, PostId, TagId) For a Post, multiple users can add one or more Tag. I want to get, via nHibernate, the tag list for a post, with the count of each Tag. Exemple or result : Tag(id1, label1), 7...

Bash script - How to take todays date and count back monthly for a year

Hi, I've made a bash script executing a PHP file: #!/bin/bash php upgrade_attendance.php refresh_daily_attendance 2010-10-01 2010-11-01 php upgrade_attendance.php refresh_daily_attendance 2010-09-01 2010-10-01 php upgrade_attendance.php refresh_daily_attendance 2010-08-01 2010-09-01 php upgrade_attendance.php refresh_daily_attendance ...

multiple GROUP BY columns into one column

Products are grouped for inspected and pass/fail on about 20 criteria. They want a report that counts how many of each defect an individual group has. Defect* is varchar(3) and is used to identify which criteria failed. The table has 3 columns for defects and I can return them with something like: SELECT GroupID, Defect1, COUNT(...

MySQL - COUNT before INSERT in one query

Hey all, I am looking for a way to query my database table only once in order to add an item and also to check what last item count was so that i can use the next number. strSQL = "SELECT * FROM productr" After that code above, i add a few product values to a record like so: ID | Product | Price | Description | Qty | D...

Search inside arrays, count, find duplicates, compare

Several HOW TO questions about simple and multidimensional arrays: 1) How to search in simple and multi arrays? 2) How to count number of search results? 3) How to catch duplicates inside: 3.1 multidimensional array? 3.2 simple array? 3.3 in array's search results? 3.4 and remove them? 4) How to compare two arrays (multidime...

MySQL COUNT can't count

Well, it can, but I can't query ;) Here's my query: SELECT code.id AS codeid, code.title AS codetitle, code.summary AS codesummary, code.author AS codeauthor, code.date, code.challengeid, ratingItems.*, FORMAT((ratingItems.totalPoints / ratingItems.totalVotes), 1) AS rating, code_tags.*, tags.*, users.firstname AS authorname, users.id ...

Counting palindromic substrings in O(n)

Given a string (assume only English characters) S of length n, we can count the number of palindromic substrings with the following algorithm: for i = 0 to |S| do p1 = number of palindromes centered in i (odd length) p2 = number of palindromes centered in i and i+1 (even length) add p1 + p2 to total number of palindromic su...

Aggregate functions in LINQ

Hello all I have the following LINQ conditional where clause query that produces a result of weights: From this, I'd like to take the result set and join on another table, tblPurchases var result = weights.Join(getsuppliersproducts.tblPurchases, w => new { w.MemberId, w.MemberName, w.LocationId, w.UnitId }, p => new { p.M...

How to count days between two dates in PHP?

If I have a couple of strings $startDate and $endDate which are set to (for instance) "2011/07/01" and "2011/07/17" (meaning 1 July 2011 and 17 July 2011). How would I count the days from start date to end date? In the example given, it would be 17 days. ...

Different faces of COUNT

I would like to know the difference between the following 4 simple queries in terms of result and functionality: SELECT COUNT(*) FROM employees; SELECT COUNT(0) FROM employees; SELECT COUNT(1) FROM employees; SELECT COUNT(2) FROM employees; ...

MySQL Query Join and Count Query

Hi, I'm trying to pull values from a database for a web app where a moderator can add companies to a list of specified industries. This request needs to pull each industry's name along with a count of attached active companies, as an overview to the moderator. These are my tables: companies ____________________________________ | id ...

Multiple count functions in a SELECT query

I have a select query like this select count(distinct id)*100/totalcount as freq, count (distinct id) from <few joins, conditions, gorup by here> ..... Will this result in 2 calculations of count under MySql 5.0? I can calculate the frequency in my appliation as well if this is a problem. I am aware of the solutions presented in htt...