Search Results

Search found 8344 results on 334 pages for 'count'.

Page 21/334 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Core Data: NSFetchRequest sorting by count of to-many relationship

    - by Ben Reeves
    Say I have an parent entity, each of which have a number of children. I want to get all the parents sorted by their number of children. Something similar to the following pseudo code: NSEntityDescription * entity = [NSEntityDescription entityForName:@"Parent" inManagedObjectContext:managedObjectContext]; [[NSSortDescriptor alloc] initWithKey:@"children.count" ascending:NO]; //Execute request Is there a way construct a fetch like this using core data? Thanks, Ben

    Read the article

  • counter_cache rails a child creation should increment the count intwo different models based on cond

    - by aditi-syal
    Hi, I have 3 models Recommendation Job Qualification Recommendation model has two fields as work_type and work_id(foreign key for job/qualification based on work_type as "J"/"Q") I am facing problem in using counter_cache I have done this in recommendation.rb belongs_to :job , :counter_cache = true, :foreign_key = "work_id" belongs_to :qualification , :counter_cache = true, :foreign_key = "work_id" and in job and qualification model files has_many :recommendations , :conditions = {:work_type = "J"} has_many :recommendations , :conditions = {:work_type = "Q"} Both Job and Qualification Models have a column as recommendations_count The problem is every time an object of recommendation is created count is increased in the both the models Please help me with this Thanks

    Read the article

  • Sort by two values prioritizing on one of them

    - by Dojie
    How would I sort this data by count and year values in ascending order prioritizing on the count value? //sort this var data = [ { count: '12', year: '1956' }, { count: '1', year: '1971' }, { count: '33', year: '1989' }, { count: '33', year: '1988' } ]; //to get this var data = [ { count: '1', year: '1971' }, { count: '12', year: '1956' }, { count: '33', year: '1988' }, { count: '33', year: '1989' }, ];

    Read the article

  • count columns group by

    - by zhangzhong
    I hava the sql as below: select a.dept, a.name from students a group by dept, name order by dept, name And get the result: dept name -----+--------- CS | Aarthi CS | Hansan EE | S.F EE | Nikke2 I want to summary the num of students for each dept as below: dept name count -----+-----------+------ CS | Aarthi | 2 CS | Hansan | 2 EE | S.F | 2 EE | Nikke2 | 2 Math | Joel | 1 How shall I to write the sql?

    Read the article

  • T SQL Count question

    - by johniom
    I'm making a report at work which looks at 5 columns which all contain v1aa, v1ab and v1ac. What I want to do is count up all the v1aa in the 5 columns and show the results (and the same for v1ab and v1ac) An example of how I like it to be displayed as is as follows :- Amber = 3 (v1aa code) Blue = 2 (v1ab code) Red = 1 (v1ac code) Could anyone give me any tips how to get me started?

    Read the article

  • Count warnings in Python 2.4

    - by l0b0
    I've got some tests that need to count the number of warnings raised by a function. In Python 2.6 this is simple, using with warnings.catch_warnings(record=True) as warn: ... self.assertEquals(len(warn), 2) Unfortunately, with is not available in Python 2.4, so what else could I use? I can't simply check if there's been a single warning (using warning filter with action='error' and try/catch), because the number of warnings is significant.

    Read the article

  • how to find the active thread count?

    - by DayOne
    Hi, i have a c# program which calls into a c++ library. The c# programs process has a high thread count 50 - 60. Most seem to be created in c++ and i supect most are suspended/waiting. How do i find how many of these threads are active at a given point in time? thanks

    Read the article

  • Linq-to-SQL: How to perform a count on a sub-select

    - by Peter Bridger
    I'm still trying to get my head round how to use LINQ-to-SQL correctly, rather than just writing my own sprocs. In the code belong a userId is passed into the method, then LINQ uses this to get all rows from the GroupTable tables matching the userId. The primary key of the GroupUser table is GroupUserId, which is a foreign key in the Group table. /// <summary> /// Return summary details about the groups a user belongs to /// </summary> /// <param name="userId"></param> /// <returns></returns> public List<Group> GroupsForUser(int userId) { DataAccess.KINv2DataContext db = new DataAccess.KINv2DataContext(); List<Group> groups = new List<Group>(); groups = (from g in db.Groups join gu in db.GroupUsers on g.GroupId equals gu.GroupId where g.Active == true && gu.UserId == userId select new Group { Name = g.Name, CreatedOn = g.CreatedOn }).ToList<Group>(); return groups; } } This works fine, but I'd also like to return the total number of Users who are in a group and also the total number of Contacts that fall under ownership of the group. Pseudo code ahoy! /// <summary> /// Return summary details about the groups a user belongs to /// </summary> /// <param name="userId"></param> /// <returns></returns> public List<Group> GroupsForUser(int userId) { DataAccess.KINv2DataContext db = new DataAccess.KINv2DataContext(); List<Group> groups = new List<Group>(); groups = (from g in db.Groups join gu in db.GroupUsers on g.GroupId equals gu.GroupId where g.Active == true && gu.UserId == userId select new Group { Name = g.Name, CreatedOn = g.CreatedOn, // ### This is the SQL I would write to get the data I want ### MemberCount = ( SELECT COUNT(*) FROM GroupUser AS GU WHERE GU.GroupId = g.GroupId ), ContactCount = ( SELECT COUNT(*) FROM Contact AS C WHERE C.OwnerGroupId = g.GroupId ) // ### End of extra code ### }).ToList<Group>(); return groups; } }

    Read the article

  • Count number of arguments to Excel formula in VBA

    - by Abiel
    I need to use VBA to determine the number of arguments passed to an Excel formula. For instance, suppose a cell contains the formula =MyFunc($A$1, "xyz", SUM(1,2,COUNT(C1:C12)), IF(B12,1,0)). Then the counter function should return 4. Does VBA contain any built-in functions for this, or does someone have an example of a regular expression that could calculate this?

    Read the article

  • NHibernate - Retrieve specific columns and count using criteria querie

    - by Cristian Sapino
    This is my mapping file: This is the other with joined-subclass class name="CRMStradCommon.Entities.ContactoEntity,CRMStradCommon" table="contacto" dynamic-update="true" Haw can I make this query with Criteria? SELECT contacto.id, contacto.nombre, persona.apellido, COUNT(*) AS Cant FROM contacto INNER JOIN oportunidad ON contacto.id = oportunidad.dueno LEFT OUTER JOIN persona ON contacto.id = persona.id LEFT OUTER JOIN empresa ON contacto.id = empresa.id GROUP BY contacto.id, contacto.nombre, persona.apellido ORDER BY contacto.nombre, persona.apellido Thanks a lot!

    Read the article

  • Count down in asp.net

    - by user221919
    Hi I need to give the count down as shown in the following link for each item using asp.net with c#. http://www.bidrivals.com/us/ Please help me out from this problem Thanking you Waiting for your valuable thoughts.

    Read the article

  • mysql - count rows by field

    - by Qiao
    all rows in table have type field. It is either 0 or 1. I need to count rows with 0 and with 1 in one query. So that result is something like: type0 type1 1234 4211 How it can be implemented?

    Read the article

  • Count rows in Drupal views plugin

    - by Rimian
    I've written myself a Drupal Views row plugin and I want to count the rows so I can do something with the output every Nth row. I can do this in the plugin's preprocessor function but if it gets used more than once (in panels for example) I can't reset the counter to zero. Can someone point me in the right direction here?

    Read the article

  • mysql count query

    - by S.PRATHIBA
    Hi all, i have the following table: mysql select * from consumer1; Service_ID | Service_Type | consumer_feedback 31 Printer -1 34 Printer 0 31 Printer 0 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 34 Printer 1 I need a query such that I need THE COUNT(Service_ID)=2 AS Service_ID is 31 and 34.Please help me and give me some suggestions.

    Read the article

  • Getting MySQL record count with C#

    - by she hates me
    Hello, I would like to know how can I get record count of a query with C#. Here is the code that I use.. MySqlDataReader recordset = null; query = new MySqlCommand("SELECT * FROM test ORDER BY type_ID ASC", this.conn); recordset = query.ExecuteReader(); while (recordset.Read()) { result.Add(recordset["type_ID"].ToString()); } return result;

    Read the article

  • Showing bug count or CI build on a TV in the office

    - by Matt Frear
    I recently saw a blog post showing off different displays that some software development shops use for showing their bug count or CI build status on a nice TV in the office. I can't for the life of me find it now, and I can't find it on google either. Anyone know what I'm talking about? (I don't think this belongs on superuser or serverfault either) -Matt

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >