Search Results

Search found 11153 results on 447 pages for 'count zero'.

Page 38/447 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • Codeigniter active record select, left join, count

    - by sea_1987
    Hi There, I have a form that shows results from a database query, these results can have many other assets ajoined to them and I wanting to find a way of showing how many assets each elemement has. For example my table is of areas of england an other table has where the users live I current have this code, $this->db->select('*'); $this->db->from('places'); $this->db->join('users, places.place_id = user.place_id, left'); $this->db->get(); The issue I am having is getting the query to return the place name and the number of users living in that place, it is possible?

    Read the article

  • webservice method is not accessible from jquery ajax

    - by Abhisheks.net
    Hello everyone.. i am using jqery ajax to calling a web service method but is is not doing and genrating error.. the code is here for jquery ajax in asp page var indexNo = 13; //pass the value $(document).ready(function() { $("#a1").click(function() { $.ajax({ type: "POST", url: "myWebService.asmx/GetNewDownline", data: "{'indexNo':user_id}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $("#divResult").text(msg.d); } }); }); }); and this is the is web service method using System; using System.Collections; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using System.Data; using System.Web.Script.Serialization; using TC.MLM.DAL; using TC.MLM.BLL.AS; /// /// Summary description for myWebService /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class myWebService : System.Web.Services.WebService { public myWebService() { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public string GetNewDownline(string indexNo) { IndexDetails indexDtls = new IndexDetails(); indexDtls.IndexNo = "13"; DataSet ds = new DataSet(); ds = TC.MLM.BLL.AS.Index.getIndexDownLineByIndex(indexDtls); indexNoDownline[] newDownline = new indexNoDownline[ds.Tables[0].Rows.Count]; for (int count = 0; count <= ds.Tables[0].Rows.Count - 1; count++) { newDownline[count] = new indexNoDownline(); newDownline[count].adjustedid = ds.Tables[0].Rows[count]["AdjustedID"].ToString(); newDownline[count].name = ds.Tables[0].Rows[count]["name"].ToString(); newDownline[count].structPostion = ds.Tables[0].Rows[count]["Struct_Position"].ToString(); newDownline[count].indexNo = ds.Tables[0].Rows[count]["IndexNo"].ToString(); newDownline[count].promoterId = ds.Tables[0].Rows[count]["PromotorID"].ToString(); newDownline[count].formNo = ds.Tables[0].Rows[count]["FormNo"].ToString(); } JavaScriptSerializer serializer = new JavaScriptSerializer(); JavaScriptSerializer js = new JavaScriptSerializer(); string resultedDownLine = js.Serialize(newDownline); return resultedDownLine; } public class indexNoDownline { public string adjustedid; public string name; public string indexNo; public string structPostion; public string promoterId; public string formNo; } } please help me something.

    Read the article

  • MySQL Query Help, including a count?

    - by nobosh
    Any ideas why this isn't working in MySQL? SELECT blogentry.*, person.personName, (SELECT * FROM BlogEntryComment Where BlogEntryID = '8') as CommentCount FROM blogentry INNER JOIN person ON blogentry.personID = person.personID WHERE blogentry.deleted = 'N' ORDER BY blogentry.dateAdded DESC

    Read the article

  • ifconfig packet count

    - by kumar
    Hi, if I type ifconfig i get packet for Tx and RX ... where exactly the piece of code to increment this counter? Is it in the network driver itself? or in the kernel ? If possible please provide lxr link of the counter variable used. Thx !

    Read the article

  • Delphi Phrase Count

    - by Brad
    Does anyone know how to or have some code on counting the number of unique phrases in a document? (Single word, two word phrases, three word phrases). Thanks

    Read the article

  • django: displaying group users count in admin

    - by gruszczy
    I would like to change admin for a group, so it would display how many users are there in a certain group. I'd like to display this in the view showing all groups, the one before you enter admin for certain group. Is it possible? I am talking both about how to change admin for a group and how to add function to list_display.

    Read the article

  • Rails model relations depending on count of nested relations

    - by Lowgain
    I am putting together a messaging system for a rails app I am working on. I am building it in a similar fashion to facebook's system, so messages are grouped into threads, etc. My related models are: MsgThread - main container of a thread Message - each message/reply in thread Recipience - ties to user to define which users should subscribe to this thread Read - determines whether or not a user has read a specific message My relationships look like class User < ActiveRecord::Base #stuff... has_many :msg_threads, :foreign_key => 'originator_id' #threads the user has started has_many :recipiences has_many :subscribed_threads, :through => :recipiences, :source => :msg_thread #threads the user is subscribed to end class MsgThread < ActiveRecord::Base has_many :messages has_many :recipiences belongs_to :originator, :class_name => "User", :foreign_key => "originator_id" end class Recipience < ActiveRecord::Base belongs_to :user belongs_to :msg_thread end class Message < ActiveRecord::Base belongs_to :msg_thread belongs_to :author, :class_name => "User", :foreign_key => "author_id" end class Read < ActiveRecord::Base belongs_to :user belongs_to :message end I'd like to create a new selector in the user sort of like: has_many :updated_threads, :through => :recipiencies, :source => :msg_thread, :conditions => {THREAD CONTAINS MESSAGES WHICH ARE UNREAD (have no 'read' models tying a user to a message)} I was thinking of either writing a long condition with multiple joins, or possibly writing giving the model an updated_threads method to return this, but I'd like to see if there is an easier way first. Any ideas? Also, if there is something fundamentally wrong with my structure for this functionality let me know! Thanks!!

    Read the article

  • XSLT: Whole table columns count.

    - by kalininew
    Good afternoon, gentlemen. Please help us solve the problem, I do not have enough brains to solve it by myself. There is a table, you must define "simple" it or "complicated". Table "simple" if each row contain only two column, otherwise it is "complicated" table. How to do this means xslt.

    Read the article

  • SQL Group By Modulo of Row Count

    - by Alex Czarto
    I have the following sample data: Id Name Quantity 1 Red 1 2 Red 3 3 Blue 1 4 Red 1 5 Yellow 3 So for this example, there are a total of 5 Red, 1 Blue, and 3 Yellow. I am looking for a way to group them by Color, but with a maximum of 2 items per group (sorting is not important). Like so: Name QuantityInPackage Red 2 Red 2 Red 1 Blue 1 Yellow 2 Yellow 1 Any suggestions on how to accomplish this using T-SQL on MS-SQL 2005?

    Read the article

  • Oracle Merge Rejection Row Count

    - by Andrew
    Given an Oracle Merge statement with a rejection limit, is there a shorthand way to identify how many rows were rejected, without being forced to query the rejection destination? The rejection destination has records pre-merge, so would currently have to be counted twice and the difference taken, but it seems like there should be a counter exposed, given that it has to be aware of whether it has exceeded the rejection limit.

    Read the article

  • sort items based on their appears count

    - by ANIL MANE
    Hello Experts, I have data like this d b c a d c b a b c a c a d c if you analyse, you will find the appearance of each element as follows a: 4 b: 3 c: 5 d: 2 According to appearance my sorted elements would be c,a,b,d and final output should be c b d a d c b a b c a c a d c Any clue, how we can achieve this using sql query ?

    Read the article

  • Presentmodalviewcontroller method problem with retain count

    - by Infinity
    Hello guys! I am trying to present a modal view controller. I have read the documentation, but something is strange. Here's my code: NSLog(@"rc: %d", [modalViewController retainCount]); UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalViewController]; [self presentModalViewController:navigationController animated:YES]; [navigationController release]; NSLog(@"rc: %d", [modalViewController retainCount]); And on the console, appears: rc: 2 rc: 24 And I think 24 is very strange... What do you thin? Why is this happening?

    Read the article

  • Custom Validation on jquery validate plugin, need to count element in a multiple select

    - by 0plus1
    I have a multiple select, and I need to force the user to choose maximum two options, nothing more. I'm trying this: jQuery.validator.addMethod("morethantwo", function(value, element) { var foo = []; $(element+' :selected').each(function(i, selected){ foo[i] = $(selected).text(); alert(foo[i]); }); return true; },"Max two options." ); The problem is that I get a: uncaught exception: Syntax error, unrecognized expression: [object HTMLSelectElement] error. While if I do this: $(element).each(function(i, selected){ foo[i] = $(selected).text(); alert(foo[i]); }); It works but I get all the options in the select. Why is that? Is this the correct road to walk? Are there better ways to do this kind of check? Thank you very much!

    Read the article

  • SQL Count Query with Grouping by multiple Columns

    - by Christian
    I have a table with three filled columns named "Name", "City" and "Occupation". I want to create a new column in the same table that contains the number of people who have the same occupation. "Name" | "City" | "Occupation" ------------------------------ Amy | Berlin | Plumber Bob | Berlin | Plumber Carol | Berlin | Lawyer David | London | Plumber I want to have a table that contains: "Name" | "City" | "Occupation" | "Number" --------------------------------------- Amy | Berlin | Plumber | 2 Bob | Berlin | Plumber | 2 Carol | Berlin | Lawyer | 1 David | London | Plumber | 1 How does the SQL Query that creates the new columns have to look like? I want to actually create a new column in the database that I can access later.

    Read the article

  • Limiting selected rows count with a stored procedure parameter in MySQL

    - by ssobczak
    I have a procedure SelectProc wich contains SELECT statement. I want to add a procedure param LimitRowsCount and use it as following: CREATE PROCEDURE SelectProc (IN LimitRowsCount INTEGER UNSIGNED) BEGIN SELECT (...) LIMIT LimitRowsCount; END but this approach doesn't work. The SELECT itself contains nested subqueries so I can't create view from it. Is there a way more propper then dynamic SQL (prepared statements) ?

    Read the article

  • SQL count NULL cells

    - by Giuseppe
    Dear All, I have the following problem. I have a table in a db, with many columns. I can do different kind of select queries, to show, for example, for each record that satisfies a condition: all cells from columns with names ending in _t0 all cells from columns with names ending in _t1 ... To get the column lists to form the queries I use the information schema. Now, the problem: each query returns a record with a subset of the columns of the big table. This means that I can get a row of (all!) NULLs. How can I ask my query to reject such rows without having to type in explicitely the column names (i.e. by saying where col_1 is not null, col_2 is not null...)? Is it possible? Thanks in advance!!! Sep

    Read the article

  • Count Records Returned MySQL Doctrine

    - by 01010011
    Hi, How do I check the number of records returned from a search of my MySQL database with a statement like this: $searchKey = 'Something to search for'; $searchResults = Doctrine::getTable('TableName')->createQuery('t')- >where('columnName LIKE ?','%'.$searchKey.'%')->execute();

    Read the article

  • SQL Count Query with Grouping by multiple Rows

    - by Christian
    I have a table with three filled rows named "Name", "City" and "Occupation". I want to create a new row in the same table that contains the number of people who have the same occupation. "Name" | "City" | "Occupation" ------------------------------ Amy | Berlin | Plumber Bob | Berlin | Plumber Carol | Berlin | Lawyer David | London | Plumber I want to have a table that contains: "Name" | "City" | "Occupation" | "Number" --------------------------------------- Amy | Berlin | Plumber | 2 Bob | Berlin | Plumber | 2 Carol | Berlin | Lawyer | 1 David | London | Plumber | 1 How does the SQL Query that creates the new row have to look like? I want to actually create a new row in the database that I can access later.

    Read the article

  • PHP Post Count in Forum

    - by Chris
    I'm currently desiging a forum application, I considered using a premade but decided against it as it's useful for me to learn some of the techniques. So I've written a fairly full featured forum... great. One of the problems I want to solve is to include user data for each post, at the minute the post table includes the poster ID (obviously) and I added the poster's username at a later date so I didn't have to query the User DB for X number of posts in a thread. However, it's become apparent I now want to do this, usernames don't need to update retrospectively, however avatars, sigs, and especially post counts need to update actively, so data in some form needs keeping up to date somewhere... What would be a good way of implementing this? I obviously don't want to include any more user data on the Posts DB table than necessary, but I'm struggling to find an easy way to do this short of querying the DB for each post in a thread, which is potentially going to create a lot of traffic. How have other people solved this, I've been examining the code on some other open source apps but I can't find what I'm looking for. Is it possible to select multiple records in one query? In which case I could build an array dynamically on each page request (eg 'SQL blah blah' then a for each loop to insert the ID's). Could I join the tables each time? Do I submit a query for each post? Hmm.

    Read the article

  • Count the prime numbers from 2 to 100 with simpler code than this

    - by RufioLJ
    It has to be with just functions, variables, loops, etc (Basic stuff). I'm having trouble coming up with the code from scratch from what I've I learned so far(Should be able to do it). Makes me really mad :/. If you could give me step by step to make sure I understand I'd really really appreciated. Thanks a bunch in advanced. How could I get the same result with a simpler code than this one: var primes=4; for (var counter = 2; counter <= 100; counter = counter + 1) { var isPrime = 0; if(isPrime === 0){ if(counter === 2){console.log(counter);} else if(counter === 3){console.log(counter);} else if(counter === 5){console.log(counter);} else if(counter === 7){console.log(counter);} else if(counter % 2 === 0){isPrime=0;} else if(counter % 3 === 0){isPrime=0;} else if(counter % 5 === 0){isPrime=0;} else if(counter % 7 === 0){isPrime=0;} else { console.log(counter); primes = primes + 1; } } } console.log("Counted: "+primes+" primes");

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >