Search Results

Search found 8796 results on 352 pages for 'triangle count'.

Page 2/352 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • SQL SERVER – Solution – Puzzle – SELECT * vs SELECT COUNT(*)

    - by pinaldave
    Earlier I have published Puzzle Why SELECT * throws an error but SELECT COUNT(*) does not. This question have received many interesting comments. Let us go over few of the answers, which are valid. Before I start the same, let me acknowledge Rob Farley who has not only answered correctly very first but also started interesting conversation in the same thread. The usual question will be what is the right answer. I would like to point to official Microsoft Connect Items which discusses the same. RGarvao https://connect.microsoft.com/SQLServer/feedback/details/671475/select-test-where-exists-select tiberiu utan http://connect.microsoft.com/SQLServer/feedback/details/338532/count-returns-a-value-1 Rob Farley count(*) is about counting rows, not a particular column. It doesn’t even look to see what columns are available, it’ll just count the rows, which in the case of a missing FROM clause, is 1. “select *” is designed to return columns, and therefore barfs if there are none available. Even more odd is this one: select ‘blah’ where exists (select *) You might be surprised at the results… Koushik The engine performs a “Constant scan” for Count(*) where as in the case of “SELECT *” the engine is trying to perform either Index/Cluster/Table scans. amikolaj When you query ‘select * from sometable’, SQL replaces * with the current schema of that table. With out a source for the schema, SQL throws an error. so when you query ‘select count(*)’, you are counting the one row. * is just a constant to SQL here. Check out the execution plan. Like the description states – ‘Scan an internal table of constants.’ You could do ‘select COUNT(‘my name is adam and this is my answer’)’ and get the same answer. Netra Acharya SELECT * Here, * represents all columns from a table. So it always looks for a table (As we know, there should be FROM clause before specifying table name). So, it throws an error whenever this condition is not satisfied. SELECT COUNT(*) Here, COUNT is a Function. So it is not mandetory to provide a table. Check it out this: DECLARE @cnt INT SET @cnt = COUNT(*) SELECT @cnt SET @cnt = COUNT(‘x’) SELECT @cnt Naveen Select 1 / Select ‘*’ will return 1/* as expected. Select Count(1)/Count(*) will return the count of result set of select statement. Count(1)/Count(*) will have one 1/* for each row in the result set of select statement. Select 1 or Select ‘*’ result set will contain only 1 result. so count is 1. Where as “Select *” is a sysntax which expects the table or equauivalent to table (table functions, etc..). It is like compilation error for that query. Ramesh Hi Friends, Count is an aggregate function and it expects the rows (list of records) for a specified single column or whole rows for *. So, when we use ‘select *’ it definitely give and error because ‘*’ is meant to have all the fields but there is not any table and without table it can only raise an error. So, in the case of ‘Select Count(*)’, there will be an error as a record in the count function so you will get the result as ’1'. Try using : Select COUNT(‘RAMESH’) and think there is an error ‘Must specify table to select from.’ in place of ‘RAMESH’ Pinal : If i am wrong then please clarify this. Sachin Nandanwar Any aggregate function expects a constant or a column name as an expression. DO NOT be confused with * in an aggregate function.The aggregate function does not treat it as a column name or a set of column names but a constant value, as * is a key word in SQL. You can replace any value instead of * for the COUNT function.Ex Select COUNT(5) will result as 1. The error resulting from select * is obvious it expects an object where it can extract the result set. I sincerely thank you all for wonderful conversation, I personally enjoyed it and I am sure all of you have the same feeling. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: CodeProject, Pinal Dave, PostADay, Readers Contribution, Readers Question, SQL, SQL Authority, SQL Puzzle, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology

    Read the article

  • After Effect - Triangle Wave (JavaScript)

    - by PJ Palomaki
    Hi, I'm trying to control a parameter with AE expressions and I need a triangle wave. I've got this so far: freq = 20; amplitude = 8; m = amplitude; i = time*freq; m - (i % (2*m) - m); Unfortunately this gives a saw wave (see below) and my math's a bit rusty, any takers? Thanks! PJ http://i25.photobucket.com/albums/c73/pjburnhill/Screenshot2010-04-09at153815.png

    Read the article

  • How do I draw a single Triangle with XNA and fill it with a Texture?

    - by Deukalion
    I'm trying to wrap my head around: http://msdn.microsoft.com/en-us/library/bb196409.aspx I'm trying to create a method in XNA that renders a single Triangle, then later make a method that takes a list of Triangles and renders them also. But it isn't working. I'm not understanding what all the things does and there's not enough information. My methods: // Triangle is a struct with A, B, C (didn't include) A, B, C = Vector3 public static void Render(GraphicsDevice device, List<Triangle> triangles, Texture2D texture) { foreach (Triangle triangle in triangles) { Render(device, triangle, texture); } } public static void Render(GraphicsDevice device, Triangle triangle, Texture2D texture) { BasicEffect _effect = new BasicEffect(device); _effect.Texture = texture; _effect.VertexColorEnabled = true; VertexPositionColor[] _vertices = new VertexPositionColor[3]; _vertices[0].Position = triangle.A; _vertices[1].Position = triangle.B; _vertices[2].Position = triangle.B; foreach (var pass in _effect.CurrentTechnique.Passes) { pass.Apply(); device.DrawUserIndexedPrimitives<VertexPositionColor> ( PrimitiveType.TriangleList, _vertices, 0, _vertices.Length, new int[] { 0, 1, 2 }, // example has something similiar, no idea what this is 0, 3 // 3 = gives me an error, 1 = works but no results ); } }

    Read the article

  • Count Distinct With IF in MySQL?

    - by user1600801
    I need to do a query with count distinct and IF, but the results always are 0. What I need to do, is count the different users from a table in different months, using IF. My individual query, for one month is this: SELECT COUNT(DISTINCT(idUsers)) AS num_usuarios FROM table01 WHERE date1='201207' But I need to get the results by different months in the same query. What I'm trying to do is this: SELECT IF(date1=(201207), count(distinct(idUsers)), 0) as user30, IF(fecha1=(201206), count(distinct(idUsers)), 0) as user60, IF(fecha1=(201205), count(distinct(idUsers)), 0) as user90, IF(fecha1=(201204), count(distinct(idUsers)), 0) as user120, IF(fecha1=(201203), count(distinct(idUsers)), 0) as user150 FROM table01 But the all the results are always 0.

    Read the article

  • NSMutableArray: count is a method or a property?

    - by Rafael Oliveira
    I want to verify if I'm in the last cell of the UITable. Should I use a NSInteger property in my controller and store the value of the count of the data (it's an NSMutableArray) that populates the table? I'm asking because I don't know if count iterates over all objects of the array to count or if it only gets me a value of a count property. What would be better ? store the value: myCount = [myArray count] use directly: [myArray count] store numberOfRows: myCount = numberOfRowsInSection:[indexPath 0] use numberOfRows directly: numberOfRowsInSection:[indexPath 0]

    Read the article

  • Android: Constructing a triangle based on Geographical information

    - by Aidan
    Hi Guys, I'm constructing a geolocation based application and I'm trying to figure out a way to make my application realise when a user is facing the direction of the given location (a particular long / lat co-ord). I've got the math figured, I just have the triangle to construct. Here's a further clarification of what I want to do.. I just want to know is there a way to get java to construct 2 other co-ordinates based on my orientation in relation to true north and my current co-ordinate? I'd like to construct a tri-angle, 45 degrees out each way of my current location (one of the points) and 1 kilometer in that direction. The problem is I don't know how to make Android/Java recognise that I want to find that point in the direction I'm currently facing.. Anyone got any ideas?

    Read the article

  • Printing a sideways triangle in java

    - by Will
    I'm trying to print a sideways triangle in java. If the user enters 5, the output should be: * *** ***** *** * If the user enters 6, the output should be: * *** ***** ***** *** * I've gotten it to work for the case when the user enters 5, 3, or 1 but my code seems to work for those three cases only. I was wondering if anyone could help me get my code working for more cases. Here it is: public void printArrow( int n ) { int asterisks = 1; for ( int i = 0; i <= n/2; i++ ) { for ( int j = i; j < asterisks; j++ ) { System.out.print( "*" ); } asterisks += 3; System.out.println(); } asterisks = asterisks / 2 - 2; for ( int i = 0; i < n/2; i++ ) { for ( int k = i; k < asterisks; k++ ) { System.out.print( "*" ); } if ( i == 1 ) { System.out.print( "*" ); } asterisks -= 2; System.out.println(); } }

    Read the article

  • best way to compute vertex normals from a Triangle's list

    - by nkint
    hi i'm a complete newbie in computergraphics so sorry if it's a stupid answer. i'm trying to make a simple 3d engine from scratch, more for educational purpose than for real use. i have a Surface object with inside a Triangle's list. For now i compute normals inside Triangle class, in this way: triangle.computeFaceNormals() { Vec3D u = v1.sub(v3) Vec3D v = v1.sub(v2) Vec3D normal = Vec3D.cross(u,v) normal.normalized() this.n1 = this.n2 = this.n3 = normal } and when building surface: t = new Triangle(v1,v2,v3).computeFaceNormals() surface.addTriangle(t) and i think this is the best way to do that.. isn't it? now.. what about for vertex normals? i've found this simple algorithm: flipcode vertex normal but.. hei this algorithm has.. exponential complexity? (if my memory doesn't fail my computer science background..) (bytheway.. it has 3 nested loops.. i don't think it's the best way to do it..) any suggestion?

    Read the article

  • Linq, double left join and double count

    - by Fabian Vilers
    Hi! I'm looking to translate this SQL statement to a well working & performant LINQ command. I've managed to have the first count working using the grouping count and key members, but don't know how to get the second count. select main.title, count(details.id) as details, count(messages.id) as messages from main left outer join details on main.id = details.mainid left outer join messages on details.id = messages.detailid group by main.title Any advice is welcome! Fabian

    Read the article

  • How to do a UITable cell with triangle indicator?

    - by zardon
    In the Linked in iphone application I noticed that they have a tableview, see the following picture with what appears to have a triangle indicator pointing upwards. Notice how the tableview cell has a little triangle pointing upwards and is part of a tableview cell. The triangle is the ---^--- part of the image. I'm wondering. How do you make a UITableView with this triangle indicator, and what is this effect called? Thanks

    Read the article

  • how do I deconstruct COUNT()?

    - by user151841
    I have a view with some joins in it. I'm doing a select from that view with COUNT(*) as one of the columns of the select. I'm surprised by the number it's returning. Note that there is no GROUP BY nor aggregate column statement in the source view that the query is drawing from. How can I take it apart to see how it arrives at this number? I have three columns in the GROUP BY clause. SELECT column1, column2, column3, COUNT(*) FROM View GROUP BY column1, column2, column3 I get a result like +---------+---------+---------+----------+ | column1 | column2 | column3 | COUNT(*) | +---------+---------+---------+----------+ | value1 | valueA | value_a | 103 | +---------+---------+---------+----------+ | value2 | valueB | value_b | 56 | +---------+---------+---------+----------+ etc. I'd like to see how it arrives at that 103, 26, etc. In other words, I want to run a query that returns 103 rows of something, so that I know that I've expressed the query properly. I'm double-checking my work. I'm not saying that I think COUNT(*) doesn't work ( I know that "SELECT is not broken" ), what I want to double-check is exactly what I'm expressing in my query, because I think I've expressed the wrong thing, which would be why I'm getting unexpected values. I need to see more what I'm actually directing MySQL to count. So should I take them one by one, and try out each value in a WHERE clause? In other words, should I do SELECT column1 FROM View WHERE column1 = 'first_grouped_value' SELECT column1 FROM View WHERE column1 = 'second_grouped_value' SELECT column2 FROM View WHERE column1 = 'first_grouped_value' SELECT column2 FROM View WHERE column1 = 'second_grouped_value' and see the row count returned matches the COUNT(*) value in the grouped results? Because of confidentiality, I won't be able to post any of the query or database structure. All I'm asking for is a general technique to see what COUNT(*) is actually counting.

    Read the article

  • Triangle count for model is doubled during render

    - by zarawesome
    I am working with the Trinigy 3d engine, and it reports models to have twice as many triangles during render than it does in the model display (let's say 4000 instead of 2000). If I render the model with an additional outline shader, it reports 6000 triangles, so it's not a simple duplication. What could be the problem?

    Read the article

  • getting count(*) using createSQLQuery in hibernate?

    - by JohnSmith
    I have several sql queries that I simply want to fire at the database. I am using hibernate throughout the whole application, so i would prefer to use hibernate to call this sql queries. In the example below i want to get count + name, but cant figure out how to get that info when i use createSQLQuery(). I have seen workarounds where people only need to get out a single "count()" from the result, but in this case I am using count() + a column as ouput SELECT count(*), a.name as count FROM user a WHERE a.user_id IN (SELECT b.user_id FROM user b) GROUP BY a.name HAVING COUNT(*) BETWEEN 2 AND 5; fyi, the above query would deliver a result like this if i call it directly on the database: 1, John 2, Donald 1, Ralph ...

    Read the article

  • How do I draw a texture-mapped triangle in MATLAB?

    - by Petter
    I have a triangle in (u,v) coordinates in an image. I would like to draw this triangle at 3D coordinates (X,Y,Z) texture-mapped with the triangle in the image. Here, u,v,X,Y,Z are all vectors with three elements representing the three corners of the triangle. I have a very ugly, slow and unsatisfactory solution in which I (1) extract a rectangular part of the image, (2) transform it to 3D space with the transformation defined by the three points, (3) draw it with surface, and (4) finally masking out everything that is not part of the triangle with AlphaData. Surely there must be an easier way of doing this?

    Read the article

  • Count files in directories AND subdirectories? iPhone

    - by AWright4911
    I am trying to count entire files in a directory, including subdirectories. This is what I have to count files in the first folder: -(NSString *)numberOfPhotos { NSString *MyPath = @"/rootdirectory/"; NSArray *directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath:MyPath]; return [NSString stringWithFormat:@"%d", [directoryContent count]]; } I was thinking maybe something like for (file in folder){ [file count] { but doesnt seem to work.

    Read the article

  • mysql multi count() in one query

    - by atno
    Hi, I'm trying to count several joined tables but without any luck, what I get is the same numbers for every column (tUsers,tLists,tItems). My query is: select COUNT(users.*) as tUsers, COUNT(lists.*) as tLists, COUNT(items.*) as tItems, companyName from users as c join lists as l on c.userID = l.userID join items as i on c.userID = i.userID group by companyID The result I want to get is --------------------------------------------- # | CompanyName | tUsers | tlists | tItems 1 | RealCoName | 5 | 2 | 15 --------------------------------------------- what modifications do i have to do to my query to get those results? Cheers

    Read the article

  • Microsoft Word - Word count excluding specific Styles?

    - by Andrew
    Hi, I was wondering if there's a way to get a word count that excludes text with a specific Style in a Microsoft Word 2007 document? I've seen this related question, but I've got blocks of source code scattered throughout which would mean I'd have to go through each of my documents a section at a time.. Does anyone know a way to do this with a macro or a splash of VB Script or some such? Thanks you!

    Read the article

  • Return Count from Netflix oData Service When the LINQ Count() Method Doesn't Work

    - by Craig Shoemaker
    Is there a way to use a LINQ expression to request a Count query from the Netflix oData service? The Netflix documentation shows that you can return counts by appending $count to a request for a collection, but a URL like this: http://netflix.cloudapp.net/Catalog/Genres/$count Is not generated from an expression like this: var count = (from g in catalog.Genres select g).Count(); The above code returns an error saying that the Count method is not supported. Is there a way to do this in LINQ, or do I just need to make WebClient request to get the value?

    Read the article

  • Update count every second causing massive memory problems

    - by Josh
    Just on my local machine, trying the run the following script causes my computer to crash... What am I doing wrong? (function($) { var count = '6824756980'; while (count > 0) { setInterval(function() { $('#showcount').html(Math.floor(count-1)); count--; }, 1000 ); } })(jQuery); All I need to do is subtract one from the var "count" and update/display it's value every second.

    Read the article

  • MySQL: Count two things in one query?

    - by Nebs
    I have a "boolean" column in one of my tables (value is either 0 or 1). I need to get two counts: The number of rows that have the boolean set to 0 and the number of rows that have it set to 1. Currently I have two queries: One to count the 1's and the other to count the 0's. Is MySQL traversing the entire table when counting rows with a WHERE condition? I'm wondering if there's a single query that would allow two counters based on different conditions? Or is there a way to get the total count along side the WHERE conditioned count? This would be enough as I'd only have to subtract one count from the other (due to the boolean nature of the column). There are no NULL values. Thanks.

    Read the article

  • How can I selectively override a django .count() method

    - by Tom Viner
    I'm using postGresSQL and my main table has about 20,000 rows. Sometimes count() methods can take ages or even timeout. Mod.manager.filter(...).count() I need to selectively override the count() method depending on what filter has been applied. Just having a cache of results would be a great gain but I'd like to be able to say: if filter query is just {'enabled'=True} then return 20,000 without touching the db. Note: I can't prevent the call to .count() as it's inside django's pagination, which always does a count.

    Read the article

  • How do you access the value of an SQL count () query in a Java program

    - by Ankur
    I want to get to the value I am finding using the COUNT command of SQL. Normally I enter the column name I want to access into the getInt() getString() method, what do I do in this case when there is no specific column name. I have used 'AS' in the same manner as is used to alias a table, I am not sure if this is going to work, I would think not. Statement stmt3 = con.createStatement(); ResultSet rs3 = stmt3.executeQuery("SELECT COUNT(*) FROM "+lastTempTable+") AS count"); while(rs3.next()){ count = rs3.getInt("count"); }

    Read the article

  • Use count or have a field that tallies?

    - by Dan LaManna
    Fairly simple concept, making an extremely basic message board system and I want users to have a post count. Now I was debating on whether or not to have a tally in their row that is added each time a post by them is created, or subtracted by one each time a post of theirs is deleted. However I'm sure that performing a count query when the post count is requested would be more accurate due to unforseen circumstances (say a thread gets deleted and it doesn't lower their tally properly), however this seems like it would be less efficient to run a query EVERY time their post count is loaded, especially in the case of them having 10 posts on the same page and it lists their post count each post. Thoughts/Advice? Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >