Search Results

Search found 17924 results on 717 pages for 'z order'.

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

  • SQL Simple ORDER BY

    - by AeroDroid
    I'm new to SQL and I don't think this question should be hard to answer. I have a high-score table for a game that contains the columns name, score, and rank. I want to know how I can order the table by descending order each time a new score is added so the table can always stay ordered by score. I know this is the wrong way of doing this, but I hope this makes my point kind of clearer. UPDATE `HSTable`.`Highscores` ORDER BY `Highscores`.`score` DESC; What is the correct way of approaching this? One more thing, is there a way I can set it so that the ranking value always stays where it's suppose to be from the SQL, for example, 1st place is always at the top regardless the score? Thanks!

    Read the article

  • MySQL order by error in PHP

    - by theflyinghaiwian
    Hi, I'm making a simple cms system for a site I'm making for non-tech users to edit... So far so good but when I try and run this code I keep getting: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''pages' ORDER BY 'pages'.'pageOrder' ASC LIMIT 0 , 30' at line 1 By the error it looks like a problem with the order by section and indeed it works without it... $sql = "SELECT * FROM 'pages' ORDER BY 'pages'.'pageOrder' ASC LIMIT 0 , 30"; $result = mysql_query($sql) or die(mysql_error()); Now I know there is nothing wrong with the code because originally I wrote my own SQL but then after it failed I robbed some from phpmyadmin and it still gives the error but it works in phpmyadmin... I'm really at my wits end with this, help is very much appreciated thank you...

    Read the article

  • MYSQL Order By Sum of Columns

    - by djs22
    Hi all, Any idea on how to order the results of a MYSQL query by the sum of two columns rather than by a single column? Select * FROM table ORDER BY (col1+col2) desc I know that won't work., but I hope it conveys what I want to do fairly well. Thanks!

    Read the article

  • select records from table in the order in which i inserted

    - by echo
    consider a tale is as follows, EmployeeId | Name | Phone_Number Now, i insert 10 records... When i query them back, select * from myTable they are not selected in the order i inserted. I can obviously keep an autoincrement index and ORDER BY index. But i dont want to alter the table. How can i do this without altering the table?

    Read the article

  • Treeset to order elements in descending order

    - by Gaurav Saini
    Here is the piece of code that I have used for Java 5.0 TreeSet<Integer> treeSetObj = new TreeSet<Integer>( Collections.reverseOrder() ) ; Collections.reverseOrder() is used to obtain a comparator in order to reverse the way the elements are stored and iterated. Is there a more optimized way of doing it?

    Read the article

  • Non-latin-characters ordering in database with "order by"

    - by nybon
    I just found some strange behavior of database's "order by" clause. In string comparison, I expected some characters such as '[' and '_' are greater than latin characters such as 'i' considering their orders in the ASCII table. However, the sorting results from database's "order by" clause is different with my expectation. Here's my test: SQLite version 3.6.23 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table products(name varchar(10)); sqlite> insert into products values('ipod'); sqlite> insert into products values('iphone'); sqlite> insert into products values('[apple]'); sqlite> insert into products values('_ipad'); sqlite> select * from products order by name asc; [apple] _ipad iphone ipod This behavior is different from Java's string comparison (which cost me some time to find this issue). I can verify this in both SQLite 3.6.23 and Microsoft SQL Server 2005. I did some web search but cannot find any related documentation. Could someone shed me some light on it? Is it a SQL standard? Where can I find some information about this? Thanks in advance.

    Read the article

  • Enhancing an 'ORDER BY' clause to judge condition by more than 1 integer

    - by Yvonne
    Hi folks, I have some PHP code which allows me to sort a column into ascending and descending order (upon click of a table row title), which is good. It works perfectly for my D.O.B colum (with date/time field type), but not for a quantity column. For example, I have quantites of 10, 50, 100, 30 and another 100. The order seems to be only appreciating the 1st integer, so my sorting of the column ends up in this order: 10, 100, 100, 30, 50... and 50, 30, 100, 100, 10. This is obviously incorrect as 100 is bigger than 50, therefore both 100 values should appear at the end surely? It seems to me that 100 is only being taken into account as having the '1' value, then it appears before 10 because the system recognises it has another 0. Is this normal to happen? Is there any way I can solve this problem? Thanks for any help. P.S. I can show code if necessary, but would like to know if this is a common issue by default.

    Read the article

  • Disable MSBuild output of "Processing /ORDER options..."

    - by Jippers
    The output file from our project build has gone from 6MB to over 75MB in text. Diff'ing the last good build and the first time it blew up, there's a section in the output file like this in the latest: Processing /ORDER options External code objects not listed in the /ORDER file: ?onCallDisconnected@CallStateConnected@CallImpl@space@@UAEXV?$shared_ptr@VCallImpl@space@@@boost@@V?$shared_ptr@VGenericCall@space@@@5@K@Z ; framework.lib(CallStates.obj) ??_DBoolSetting@space@@QAEXXZ ; framework.lib(SettingValueImpl.obj) ...... continues for ~50MB ??$?0U?$pair@$$CBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@J@std@@@?$allocator@U_Node@?$_Tree_nod@V?$_Tmap_traits@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@JU?$less@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@J@std@@@2@$0A@@std@@@std@@@std@@QAE@ABV?$allocator@U?$pair@$$CBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@J@std@@@1@@Z ; CallStatistics.obj Finished processing /ORDER options I'm not sure how this got in there, but anyone know how to turn it off?

    Read the article

  • How to get element order number

    - by martin-masiar
    Hello everyone, how can i get order number of some element by javascript/jquery? <ul> <li>Anton</li> <li class="abc">Victor</li> <li class="abc">Simon</li> <li>Adam</li> <li>Peter</li> <li class="abc">Tom</li> </ul> There is 3xli with abc class. Now I need to get order(sequence) number of Simon li. Thanks in advance

    Read the article

  • Oracle SQL clause evaluation order

    - by jon.johnson
    In Oracle, which clause types get evaluated first? If I had the following ( pretend .... represent valid expressions and relation names ), what would the order of evaluation be? SELECT ... FROM ..... WHERE ........ GROUP BY ........... HAVING ............. ORDER BY ................ I am under the impression that the SELECT clause is evaluated last, but other than that I'm clueless.

    Read the article

  • SQL UPDATE order of evaluation

    - by pilcrow
    What is the order of evaluation in the following query: UPDATE tbl SET q = q + 1, p = q; That is, will "tbl"."p" be set to q or q + 1? Is order of evaluation here governed by SQL standard? Thanks. UPDATE After considering Migs' answer, I ran some tests on all DBs I could find. While I don't know what the standard says, implementations vary. Given CREATE TABLE tbl (p INT NOT NULL, q INT NOT NULL); INSERT INTO tbl VALUES (1, 5); -- p := 1, q := 5 UPDATE tbl SET q = q + 1, p = q; I found the values of "p" and "q" were: database p q -----------------+---+--- Firebird 2.1.3 | 6 | 6 InterBase 2009 | 5 | 6 MySQL 5.0.77 | 6 | 6 Oracle XE (10g) | 5 | 6 PostgreSQL 8.4.2 | 5 | 6

    Read the article

  • T-SQL - how to get around the order by restriction in CTEs

    - by David
    Hi all I have the following CTE. Its purpose is to provide unique Month/Year pairs. Later code will use the CTE to produce a concatenated string list of the Month/Year pairs. ;WITH tblStoredWillsInPeriod AS ( SELECT DISTINCT Kctc.GetMonthAndYearString(DateWillReceived) Month FROM Kctc.StoredWills WHERE DateWillReceived BETWEEN '2010/01/01' AND '2010/03/31' ORDER BY DateWillReceived ) I have omitted the implmementation of the GetMonthAndYearString function as it is trivial. Sadly, it seems T-SQL is always one step ahead. When I run this code, it tells me I'm not allowed to use ORDER BY in a CTE unless I also use TOP (or FOR XML, whatever that is.) If I use TOP, it tells me I can't use it with DISTINCT. Yup, T-SQL has all the answers. Can anyone think of a solution to this problem which is quicker than simply slashing my wrists? I understand that death from blood loss can be surprisingly lingering, and I have deadlines to meet. Thanks for your help. David

    Read the article

  • hibernate order by association

    - by Gary Kephart
    I'm using Hibernate 3.2, and using criteria to build a query. I'd like to add and "order by" for a many-to-one association, but I don't see how that can be done. The Hibernate query would end up looking like this, I guess: select t1.a, t1.b, t1.c, t2.dd, t2.ee from t1 inner join t2 on t1.a = t2.aa order by t2.dd <-- need to add this I've tried criteria.addOrder("assnName.propertyName") but it doesn't work. I know it can be done for normal properties. Am I missing something?

    Read the article

  • argument order in cygwin gcc 4.3 matters when linking with glib-2.0

    - by SetJmp
    I am trying to compile code that works on os x and linux using cygwin. However, I am finding that the argument order to gcc gives unanticipated results. For example, the following fails: gcc -std=gnu99 `pkg-config --libs glib-2.0 --cflags glib-2.0` nb-learn.c but the following works: gcc -std=gnu99 nb-learn.c `pkg-config --libs glib-2.0 --cflags glib-2.0` Can someone explains how this works? Also, are there techniques or code I can look at for getting autoconf to change the argument order depending on the platform? Thanks, SetJmp (gcc 4.3.4)

    Read the article

  • Parallel.For maintain input list order on output list

    - by romeozor
    I'd like some input on keeping the order of a list during heavy-duty operations that I decided to try to do in a parallel manner to see if it boosts performance. (It did!) I came up with a solution, but since this was my first attempt at anything parallel, I'd need someone to slap my hands if I did something very stupid. There's a query that returns a list of card owners, sorted by name, then by date of birth. This needs to be rendered in a table on a web page (ASP.Net WebForms). The original coder decided he would construct the table cell-by-cell (TableCell), add them to rows (TableRow), then each row to the table. So no GridView, allegedly its performance is bad, but the performance was very poor regardless :). The database query returns in no time, the most time is spent on looping through the results and adding table cells etc. I made the following method to maintain the original order of the list: private TableRow[] ComposeRows(List<CardHolder> queryResult) { int queryElementsCount = queryResult.Count(); // array with the query's size var rowArray = new TableRow[queryElementsCount]; Parallel.For(0, queryElementsCount, i => { var row = new TableRow(); var cell = new TableCell(); // various operations, including simple ones such as: cell.Text = queryResult[i].Name; row.Cells.Add(cell); // here I'm adding the current item to it's original index // to maintain order in the output list rowArray[i] = row; }); return rowArray; } So as you can see, because I'm returning a very different type of data (List<CardHolder> -> TableRow[]), I can't just simply omit the ordering from the original query to do it after the operations. Also, I also thought it would be a good idea to Dispose() the objects at the end of each loop, because the query can return a huge list and letting cell and row objects pile up in the heap could impact performance.(?) How badly did I do? Does anyone have a better solution in case mine is flawed?

    Read the article

  • Sorting a vector of (double precision) reals and obtain their order

    - by Philipp
    Hello everyone, in C++ would like to sort a lengthy (2^20) vector of reals, obviously sort() does the trick. Having used R before I was used to the nice order() function which yields the permutation that leads to the sorted vector. Probably someone has done this in C++, maybe it's just my weak google-Fu that prevents me from finding it. And yeah, obivously my C++ newbness could stop me from spotting something straightforward. Example: x = {24, 55, 22, 1} then the permutation perm = {3, 2, 0, 1} maps the original x to the sorted x in ascending order. I can probably implement some bubble sort which does not only sort x but performs the same transpositions on the vector {0,1,2,...} and outputs both, but I believe someone must have thought about it and especially have done it efficiently. Thank you very much, Philipp

    Read the article

  • Sqlite3 activerecord :order => "time DESC" doesn't sort

    - by Ole Morten Amundsen
    rails 2.3.4, sqlite3 I'm trying this Production.find(:all, :conditions = ["time ?", start_time.utc], :order = "time DESC", :limit = 100) The condition works perfectly, but I'm having problems with the :order = time DESC. By chance, I discovered that it worked at Heroku (testing with heroku console), which runs PostgreSQL. However, locally, using sqlite3, new entries will be sorted after old ones, no matter what I set time to. Like this (output has been manually stripped): second entry is new: Production id: 2053939460, time: "2010-04-24 23:00:04", created_at: "2010-04-24 23:00:05" Production id: 2053939532, time: "2010-04-25 10:00:00", created_at: "2010-04-27 05:58:30" Production id: 2053939461, time: "2010-04-25 00:00:04", created_at: "2010-04-25 00:00:04" Production id: 2053939463, time: "2010-04-25 01:00:04", created_at: "2010-04-25 01:00:04" Seems like it sorts on the primary key, id, not time. Note that the query works fine on heroku, returning a correctly ordered list! I like sqlite, it's so KISS, I hope you can help me... Any suggestions?

    Read the article

  • Unexpected behaviour of Order by clause

    - by Newbie
    I have a table which looks like Col1 col2 col3 col4 col5 1 5 1 4 6 1 4 0 3 7 0 1 5 6 3 1 8 2 1 5 4 3 2 1 4 The script is declare @t table(col1 int, col2 int, col3 int,col4 int,col5 int) insert into @t select 1,5,1,4,6 union all select 1,4,0,3,7 union all select 0,1,5,6,3 union all select 1,8,2,1,5 union all select 4,3,2,1,4 If I do a sorting (ascending), the output is Col1 col2 col3 col4 col5 0 1 5 6 3 1 4 0 3 7 1 5 1 4 6 1 8 2 1 5 4 3 2 1 4 The query is Select * from @t order by col1,col2,col3,col4,col5 But as can be seen that the sorting output is wrong (col2 to col5). I want the output to be every column being sorted in ascending order i.e. Col1 col2 col3 col4 col5 0 1 0 1 3 1 3 1 1 4 1 4 2 3 5 1 5 2 4 6 4 8 5 6 7 Why so and how to overcome this? Thanks in advance

    Read the article

  • c++ std::map question about iterator order

    - by jbu
    Hi all, I am a C++ newbie trying to use a map so I can get constant time lookups for the find() method. The problem is that when I use an iterator to go over the elements in the map, elements do not appear in the same order that they were placed in the map. Without maintaining another data structure, is there a way to achieve in order iteration while still retaining the constant time lookup ability? Please let me know. Thanks, jbu edit: thanks for letting me know map::find() isn't constant time.

    Read the article

  • MySQL ORDER BY returns things in (apparently) random order !?

    - by Luke H
    The following query: SELECT DISTINCT ClassName FROM SiteTree ORDER BY ClassName is returning things in no apparent order! I get the same result whether I quote column/table names, or use DISTINCT or not, or add ASC or DESC. I assumed the indexes might be broken, or something like this, so tried dropping and recreating. Also tried REPAIR TABLE and CHECK TABLE. The table collation is set to latin1_swedish_ci. All the textual columns are set to use UTF-8 and collation is set to utf8_general_ci What could be causing this?

    Read the article

  • Linq To SQL: Retain list order when using .Contains

    - by rockinthesixstring
    I'm using Lucene.net to build a MyListOfIds As List(Of Integer) which I then pass on to my Linq service. I then search the database as follows Return _EventRepository.Read().Where(Function(e) MyListOfIds.Contains(e.ID)).ToList Now I know that Lucene is already ordering MyListOfIds based on the weight it gave each term. What sucks is that Linq is losing that order in it's SQL search. My Question: How can I retain that sort order when building my Lambda expression? I tried using LINQPad to see how the query is being built, but because I had to declare a variable LINQPad didn't show me the resultant SQL :-( Here's what I tried in LINQPad Dim i As New List(Of Integer) i.Add(1) i.Add(100) i.Add(15) i.Add(3) i.Add(123) Dim r = (From e In Events Where i.Contains(e.ID) Select e) note: my example is in VB.NET, but I don't mind if responses are in C#

    Read the article

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