Search Results

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

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

  • How to get the records using order by and so on

    - by paulrajj
    I have a table categories containing categories id having the records of 1 to 20. when i am doing the search query by using the IN function in mysql i got the results. but i am struggling to get the results using order by. The limit may be vary for every search as this is one of the input value. For example I have tried this query to find out the search results, select * from categories where category in (20,16,12,8) order by rand(), id limit 0,6 this query is executed and the results are in random category_id. the results will be, 8 12 16 20 and following this, another two records must be 8 12 If category_id contains only one record for 8 then, it should follow from 12,16. How can i achieve this ? thanks in advance.

    Read the article

  • SQL Server 2008 Delete Records from Self-Referencing Table in correct order

    - by KTrace
    I need to delete a sub set of records from a self-referencing table in SQL Server 2008. I am trying to do the following but it is does not like the order by. WITH SelfReferencingTable (ID, depth) AS ( SELECT id, 0 as [depth] FROM dbo.Table WHERE parentItemID IS NULL AND [t].ColumnA = '123' UNION ALL SELECT [t].ID, [srt].[depth] + 1 FROM dbo.Table t INNER JOIN SelfReferencingTable srt ON [t].parentItemID = [srt].id WHERE [t].ColumnA = '123' ) DELETE y FROM dbo.Table y JOIN SelfReferencingTable x on x.ID = y.id ORDER BY x.depth DESC Any ideas why this isn't working?

    Read the article

  • Paypal (sandbox) buy now link redirects to paypal (sandbox) login page instead of order summary

    - by Nicolas
    Hi, Before going live I try to test the paypal process against the paypal sandbox mode, but after the summary of what the user is going to pay on my website(buy now button), the link does not redirect to a paypal summary of the prder but ask the user to connect to paypal. Even after logging into the buyer sandbox account there's no summary of the order. It just disappears. Here's is the code I use on the checkout page: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="XXXXXXXXXXXXXXXX"> <input type="hidden" name="notify_url" value="http://www.website.com/paypal/"> <div class="suggestion"> <input type="image" src="https://www.sandbox.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </div> </form> Any idea why it redirects to the payapl login page instead of the order one? Btw I'm using the Website Basic Payment (not PRO then). Cheers, Nicolas.

    Read the article

  • mySQL ORDER BY ASC works, DESC does not...

    - by Ben
    I've "integrated" SMF into Wordpress by querying the forum for a list of the most recent videos from a specific forum board and displaying them on the Wordpress homepage. However when I add the ORDER BY clause, the query (which I tested on other parts of the same page successfully), breaks. To add to the mix, I am using the Auto Embed plugin to allow the videos to be played on the homepage, as well as using a jCarousel feature to rotate them. People were kind enough to help me here last time with the regexp to filter the video urls, I'm hoping for the same luck this time! Here is the entire function (remove the DESC and it works...): function SMF_getRecentVids($limit=10){ global $smf_settingsphp_d; if(file_exists($smf_settingsphp_d)) include($smf_settingsphp_d); include "AutoEmbed-1.4/AutoEmbed.class.php"; $AE = new AutoEmbed(); $connect = new wpdb($db_user,$db_passwd,$db_name,$db_server); $connect->query("SET NAMES 'UTF8'"); $sql = SELECT m.subject, m.ID_MSG, m.body, m.ID_TOPIC, m.ID_BOARD, t.ID_FIRST_MSG FROM {$db_prefix}messages AS m LEFT JOIN {$db_prefix}topics AS t ON (m.ID_TOPIC = t.ID_TOPIC) WHERE (m.ID_BOARD = 8) ORDER BY t.ID_FIRST_MSG DESC"; $vids = $connect->get_results($sql); $c = 0; $content = "imageCarousel_itemList = ["; foreach ($vids as $vid) { if ($c > $limit) continue; //extract video code from body $input = $vid->body; $regexp = "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i"; if(preg_match_all($regexp, $input, $matches)) { $AE->parseUrl($matches[0][0]); $imageURL = $AE->getImageURL(); $AE->setWidth(290); $AE->setHeight(240); $content .= "{url: '".$AE->getEmbedCode()."', title: '".$vid->subject."', caption: '', description: ''},"; } $c++; } $content .= "]"; echo $content; $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); }

    Read the article

  • Mysql slow query: INNER JOIN + ORDER BY causes filesort

    - by Alexander
    Hello! I'm trying to optimize this query: SELECT `posts`.* FROM `posts` INNER JOIN `posts_tags` ON `posts`.id = `posts_tags`.post_id WHERE (((`posts_tags`.tag_id = 1))) ORDER BY posts.created_at DESC; The size of tables is 38k rows, and 31k and mysql uses "filesort" so it gets pretty slow. I tried to use different indexes, no luck. CREATE TABLE `posts` ( `id` int(11) NOT NULL auto_increment, `created_at` datetime default NULL, PRIMARY KEY (`id`), KEY `index_posts_on_created_at` (`created_at`), KEY `for_tags` (`trashed`,`published`,`clan_private`,`created_at`) ) ENGINE=InnoDB AUTO_INCREMENT=44390 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci CREATE TABLE `posts_tags` ( `id` int(11) NOT NULL auto_increment, `post_id` int(11) default NULL, `tag_id` int(11) default NULL, `created_at` datetime default NULL, `updated_at` datetime default NULL, PRIMARY KEY (`id`), KEY `index_posts_tags_on_post_id_and_tag_id` (`post_id`,`tag_id`) ) ENGINE=InnoDB AUTO_INCREMENT=63175 DEFAULT CHARSET=utf8 +----+-------------+------------+--------+--------------------------+--------------------------+---------+---------------------+-------+-----------------------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------+--------+--------------------------+--------------------------+---------+---------------------+-------+-----------------------------------------------------------+ | 1 | SIMPLE | posts_tags | index | index_post_id_and_tag_id | index_post_id_and_tag_id | 10 | NULL | 24159 | Using where; Using index; Using temporary; Using filesort | | 1 | SIMPLE | posts | eq_ref | PRIMARY | PRIMARY | 4 | .posts_tags.post_id | 1 | | +----+-------------+------------+--------+--------------------------+--------------------------+---------+---------------------+-------+-----------------------------------------------------------+ 2 rows in set (0.00 sec) What kind of index I need to define to avoid mysql using filesort? Is it possible when order field is not in where clause?

    Read the article

  • C++: Construction and initialization order guarantees

    - by Helltone
    Hi, I have some doubts about construction and initialization order guarantees in C++. For instance, the following code has four classes X, Y, Z and W. The main function instantiates an object of class X. X contains an object of class Y, and derives from class Z, so both constructors will be called. Additionally, the const char* parameter passed to X's constructor will be implicitly converted to W, so W's constructor must also be called. What are the guarantees the C++ standard gives on the order of the calls to the copy constructors? Or, equivalently, this program is allowed to print? #include <iostream> class Z { public: Z() { std::cout << "Z" << std::endl; } }; class Y { public: Y() { std::cout << "Y" << std::endl; } }; class W { public: W(const char*) { std::cout << "W" << std::endl; } }; class X : public Z { public: X(const W&) { std::cout << "X" << std::endl; } private: Y y; }; int main(int, char*[]) { X x("x"); return 0; }

    Read the article

  • How do I determine the draw order in an isometric view flash game?

    - by Gajet
    This is for a flash game, with isometric view. I need to know how to sort object so that there is no need for z-buffer checking when drawing. This might seem easy but there is another restriction, a scene can have 10,000+ objects so the algorithm needs to be run in less than O(n^2). All objects are rectangular boxes, and there are 3-4 objects moving in the scene. What's the best way to do this? UPDATE in each tile there is only object (I mean objects can stack on top of each other). and we access to both map of Objects and Objects have their own position.

    Read the article

  • Ideas to automate customer order processing? [on hold]

    - by user2753657
    i am looking for a way to automate the order processing in my webshop. Normally, a user buys a product in my webshop, then, i receive an order confirmation email with order details, address etc. After receiving the order email, I login to my suppliers website and input the order details manually. My supplier then ships the item to the address specified by me. I am looking for ideas how to automate this process, especially in the case if i receive for example 4-5 order emails at one time (and not one by one with several hours between)... I was looking at the program Winautomation, but i am not sure if this fits my needs. Any ideas are appreciated. thanks!

    Read the article

  • SQL - Order against two columns at the same time (intersecting)

    - by Alex
    I have a table with the fields CommonName and FirstName. Only either field has data, never both. Is there a way to order rows in an intersecting manner on SQL Server? Example: CommonName FirstName Bern Wade Ashley Boris Ayana I want records ordered like this: CommonName FirstName Ashley Ayana Bern Boris Wade Is this possible, and if so, how?

    Read the article

  • Inserting Records in Ascending Order function- C homework assignment

    - by Aaron McRuer
    Good day, Stack Overflow. I have a homework assignment that I'm working on this weekend that I'm having a bit of a problem with. We have a struct "Record" (which contains information about cars for a dealership) that gets placed in a particular spot in a linked list according to 1) its make and 2) according to its model year. This is done when initially building the list, when a "int insertRecordInAscendingOrder" function is called in Main. In "insertRecordInAscendingOrder", a third function, "createRecord" is called, where the linked list is created. The function then goes to the function "compareCars" to determine what elements get put where. Depending on the value returned by this function, insertRecordInAscendingOrder then places the record where it belongs. The list is then printed out. There's more to the assignment, but I'll cross that bridge when I come to it. Ideally, and for the assignment to be considered correct, the linked list must be ordered as: Chevrolet 2012 25 Chevrolet 2013 10 Ford 2010 5 Ford 2011 3 Ford 2012 15 Honda 2011 9 Honda 2012 3 Honda 2013 12 Toyota 2009 2 Toyota 2011 7 Toyota 2013 20 from the a text file that has the data ordered the following way: Ford 2012 15 Ford 2011 3 Ford 2010 5 Toyota 2011 7 Toyota 2012 20 Toyota 2009 2 Honda 2011 9 Honda 2012 3 Honda 2013 12 Chevrolet 2013 10 Chevrolet 2012 25 Notice that the alphabetical order of the "make" field takes precedence, then, the model year is arranged from oldest to newest. However, the program produces this as the final list: Chevrolet 2012 25 Chevrolet 2013 10 Honda 2011 9 Honda 2012 3 Honda 2013 12 Toyota 2009 2 Toyota 2011 7 Toyota 2012 20 Ford 2010 5 Ford 2011 3 Ford 2012 15 I sat down with a grad student and tried to work out all of this yesterday, but we just couldn't figure out why it was kicking the Ford nodes down to the end of the list. Here's the code. As you'll notice, I included a printList call at each instance of the insertion of a node. This way, you can see just what is happening when the nodes are being put in "order". It is in ANSI C99. All function calls must be made as they are specified, so unfortunately, there's no real way of getting around this problem by creating a more efficient algorithm. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 50 #define MAX_MAKE 20 typedef struct record { char *make; int year; int stock; struct record *next; } Record; int compareCars(Record *car1, Record *car2); void printList(Record *head); Record* createRecord(char *make, int year, int stock); int insertRecordInAscendingOrder(Record **head, char *make, int year, int stock); int main(int argc, char **argv) { FILE *inFile = NULL; char line[MAX_LINE + 1]; char *make, *yearStr, *stockStr; int year, stock, len; Record* headRecord = NULL; /*Input and file diagnostics*/ if (argc!=2) { printf ("Filename not provided.\n"); return 1; } if((inFile=fopen(argv[1], "r"))==NULL) { printf("Can't open the file\n"); return 2; } /*obtain values for linked list*/ while (fgets(line, MAX_LINE, inFile)) { make = strtok(line, " "); yearStr = strtok(NULL, " "); stockStr = strtok(NULL, " "); year = atoi(yearStr); stock = atoi(stockStr); insertRecordInAscendingOrder(&headRecord,make, year, stock); } printf("The original list in ascending order: \n"); printList(headRecord); } /*use strcmp to compare two makes*/ int compareCars(Record *car1, Record *car2) { int compStrResult; compStrResult = strcmp(car1->make, car2->make); int compYearResult = 0; if(car1->year > car2->year) { compYearResult = 1; } else if(car1->year == car2->year) { compYearResult = 0; } else { compYearResult = -1; } if(compStrResult == 0 ) { if(compYearResult == 1) { return 1; } else if(compYearResult == -1) { return -1; } else { return compStrResult; } } else if(compStrResult == 1) { return 1; } else { return -1; } } int insertRecordInAscendingOrder(Record **head, char *make, int year, int stock) { Record *previous = *head; Record *newRecord = createRecord(make, year, stock); Record *current = *head; int compResult; if(*head == NULL) { *head = newRecord; printf("Head is null, list was empty\n"); printList(*head); return 1; } else if ( compareCars(newRecord, *head)==-1) { *head = newRecord; (*head)->next = current; printf("New record was less than the head, replacing\n"); printList(*head); return 1; } else { printf("standard case, searching and inserting\n"); previous = *head; while ( current != NULL &&(compareCars(newRecord, current)==1)) { printList(*head); previous = current; current = current->next; } printList(*head); previous->next = newRecord; previous->next->next = current; } return 1; } /*creates records from info passed in from main via insertRecordInAscendingOrder.*/ Record* createRecord(char *make, int year, int stock) { printf("CreateRecord\n"); Record *theRecord; int len; if(!make) { return NULL; } theRecord = malloc(sizeof(Record)); if(!theRecord) { printf("Unable to allocate memory for the structure.\n"); return NULL; } theRecord->year = year; theRecord->stock = stock; len = strlen(make); theRecord->make = malloc(len + 1); strncpy(theRecord->make, make, len); theRecord->make[len] = '\0'; theRecord->next=NULL; return theRecord; } /*prints list. lists print.*/ void printList(Record *head) { int i; int j = 50; Record *aRecord; aRecord = head; for(i = 0; i < j; i++) { printf("-"); } printf("\n"); printf("%20s%20s%10s\n", "Make", "Year", "Stock"); for(i = 0; i < j; i++) { printf("-"); } printf("\n"); while(aRecord != NULL) { printf("%20s%20d%10d\n", aRecord->make, aRecord->year, aRecord->stock); aRecord = aRecord->next; } printf("\n"); } The text file you'll need for a command line argument can be saved under any name you like; here are the contents you'll need: Ford 2012 15 Ford 2011 3 Ford 2010 5 Toyota 2011 7 Toyota 2012 20 Toyota 2009 2 Honda 2011 9 Honda 2012 3 Honda 2013 12 Chevrolet 2013 10 Chevrolet 2012 25 Thanks in advance for your help. I shall continue to plow away at it myself.

    Read the article

  • MySQL specifying exact order with WHERE `id` IN (...)

    - by Gray Fox
    Is there an easy way to order MySQL results respectively by WHERE id IN (...) clause? Example: SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) to return Article with id = 4 Article with id = 2 Article with id = 5 Article with id = 9 Article with id = 3 and also SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) LIMIT 2,2 to return Article with id = 5 Article with id = 9

    Read the article

  • Order by Domain Extension Name using CodeIgniter Active Record Class

    - by allan
    $extension = “SUBSTRING_INDEX(domain_name, ‘.’, -1)”; $this->db->order_by($extension, “asc”); It says: 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 ‘asc LIMIT 50’ at line 44 But its working when I didn’t used the $this-db-order_by Active Record Class such as this one: $this-db-query(“SELECT * FROM domain ORDER BY SUBSTRING_INDEX(domain_name, ‘.’, -1)”); Anyone please help me. Thanks.

    Read the article

  • RegEx to reverse order of list?

    - by quantomcat
    Is there a singular regular expression that can be used in, say, a text editor's search/replace dialog to reverse the order of the items in a list? For instance, take this list: First item Second item Third item Select it in a text editor like EditPad, bring up the search and replace box, apply a regex (run as a loop or not) and turn it into: Third item Second item First item Can this be done?

    Read the article

  • MYSQL Select statment Order By with Group By

    - by mouthpiec
    I have the following simple SQL statment SELECT id, name, value_name, value_id FROM table GROUP BY id ORDER BY value_id DESC when grouping I would like to get the value_name and value_id of the tuple where the value_id is the biggest. The way it is i am getting the smallest value. For example 1, name1, valuename, 3 (where i know that there is a value_id of 5) Can you please help?

    Read the article

  • Perl, foreach order

    - by Mike
    Does Perl's foreach loop operator require that the list items be presented in order? For example my @a=(1,2,3); foreach my $item (@a) { print $item; } will always print 1 2 3? I suspect so, but I can't find it documented.

    Read the article

  • Substitute Items on Internal Sales Orders

    - by ChristineS-Oracle
    Oracle Order Management now enables you to substitute items on internal sales order lines to manage item availability.  Oracle Order Management enables you to substitute items on internal sales order lines to manage item availability. Source organizations can decide to ship a substitute item in case the original item is not available to be shipped. The application supports manual (using Related Items window) and automatic (using ATP functionality) substitutions.To substitute an item on ISO, you must ensure that the value of the Item Substitution on Internal Order system parameter is set to a value other than None. In addition, you must ensure to define substitute item relationships and automatic item substitution setup in the system. The application provides the option to not send the notifications when any change happens on the ISO related to quantity, schedule arrival date, or item. You can control these notifications using the OM: Send Notifications of Internal Order Change profile option. For additional information refer to the Oracle Order Management Release Notes for Release 12.2.4 (Doc ID 1906521.1).

    Read the article

  • prolog program to find equality of two lists in any order

    - by Happy Mittal
    I wanted to write a prolog program to find equality of two lists, the order of elements doesn't matter. So I wrote following: del( _ , [ ] , [ ] ) . del( X , [ X|T ] , T ). del( X , [ H|T ] , [ H|T1 ] ) :- X \= H , del( X , T , T1 ). member( X, [ X | _ ] ) . member( X, [ _ | T ] ) :- member( X, T ). equal( [ ], [ ] ). equal( [X], [X] ). equal( [H1|T], L2 ) :- member( H1, L2 ), del( H1, L2, L3), equal(T , L3 ). But when I give input like equal([1,2,3],X)., it doesn't show all possible values of X. instead the program hangs in the middle. What could be the reason?

    Read the article

  • files build execution order

    - by Mahesh
    Hi, I have a data structure which is as given below: class File { public string Value { get; set; } public File[] Dependencies { get; set; } public bool Change { get; private set; } public File(string value,File[] dependencies) { Value = value; Dependencies = dependencies; Change = false; } } Basically, this data structure follows a typical build execution of files. Each File has a value and a list of dependencies which is again of type File. Every file is exposed with a property called Change which tells whether the file is changed or not. I brainstormed to form a algorithm which goes through all these files and build in an order( i.e typical build process ) but haven't got a better algorithm. Can anyone throw some light on this? Thanks a lot. Mahesh

    Read the article

  • Override default operations order in LINQ

    - by Erick
    For one of our applications we do use LINQ to update a few reccords of the database. For business reasons we do require that only one item of a list to be primary. When we designed we decided to fire all of queries at the database at once. The problems occurs when we add one row and update the primary element to be the second item. See, the default behavior for order of operations with LINQ is to Insert, Update, Delete. If I Insert a first element I get a check constraint error with SQL Server. The best in my opinion would be to override and make sure to Update before Insert, this way we make sure that check constraints are kept. Tho there is not a lot of documentation on the mather. Any idea ?

    Read the article

  • How do you make javascript code execute *in order*

    - by Ed
    Okay, so I appreciate that Javascript is not C# or PHP, but I keep coming back to an issue in Javascript - not with JS itself but my use of it. I have a function: function updateStatuses(){ showLoader() //show the 'loader.gif' in the UI updateStatus('cron1'); //performs an ajax request to get the status of something updateStatus('cron2'); updateStatus('cron3'); updateStatus('cronEmail'); updateStatus('cronHourly'); updateStatus('cronDaily'); hideLoader(); //hide the 'loader.gif' in the UI } Thing is, owing to Javascript's burning desire to jump ahead in the code, the loader never appears because the 'hideLoader' function runs straight after. How can I fix this? Or in other words, how can I make a javascript function execute in the order I write it on the page...

    Read the article

  • Linq to NHibernate, Order by Rand() ?

    - by Felipe
    Hi everybody, I'm using Linq To Nhibernate, and with a HQL statement I can do something like this: string hql = "from Entity e order by rand()"; Andi t will be ordered so random, and I'd link to know How can I do the same statement with Linq to Nhibernate ? I try this: var result = from e in Session.Linq<Entity> orderby new Random().Next(0,100) select e; but it throws a exception and doesn't work... is there any other way or solution? Thanks Cheers

    Read the article

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