How do you keep the order using SELECT WHERE IN()?

Hi,
Is there a way to keep the order when using SELECT WHERE IN()? For example, using the following query:
SELECT id FROM data_table WHERE id IN('56','55','54','1','7');
The results will come back using the default order by id. 1,7,54,55,56
When I want to keep the order used in the IN: 56,55,54,1,7
Is there a quick way to do this in mySQL or will I be forced to order it after in code.
Thanks

797836 wrote:
Hi,
Is there a way to keep the order when using SELECT WHERE IN()? For example, using the following query:
SELECT id FROM data_table WHERE id IN('56','55','54','1','7');
The results will come back using the default order by id. 1,7,54,55,56In case the order by docs and comments weren't clear on this point, there is no default order and they may come back in a different order. Usually after you've tested it to exhaustion to prove otherwise, then put it in production.
>
When I want to keep the order used in the IN: 56,55,54,1,7
Is there a quick way to do this in mySQL or will I be forced to order it after in code.
ThanksUsing the in list allows oracle to have other possible data access paths than simply running the query 5 times. If for whatever reason you don't want to order the results after they come back, it may be worth your while to just run the five queries serially in the order you want, using bind variables and so having identical queries. That may seem silly on its face, but then again, we don't know the real requirements, what else is going on, if this is simplified from the real code or whether there will always be 5.

Similar Messages

  • When burning a playlist to disc, how do you keep the songs in original order?

    When burning a playlist to disc, how do you keep the songs in original order?

    If you are burning an audio CD, they will burn in sequential order as in your playlist.
    If you are burning an MP3 CD or a data CD, they will burn as individual files, and can be sorted any way you like when you view the CD.  For an MP3 CD, the files will be prepended with a sequence number, so if you sort by filename, they will be in the original order.

  • How do you keep the browser heading from showing?

    How do you keep the browser heading from showing in the
    output? I did this once but can't figure out how!
    Thanks in advance,
    Rosie

    You asked...
    quote:
    Is there a way to shrink the application you're capturing so it
    fits within a given capture window rather than requiring scrolling,
    or would I have to go back to the application developers for that?
    (I realize that would shrink the size of everything on the screen,
    but in some cases, that would be worth it to be able to show a
    window without scrolling.
    If, by "shrink" ... you mean by using the AppSizer, the
    answer is "not really". You can configure AppSizer to a defined
    size, then with the mouse pointer double-arrowed on the "edge" of a
    window, right-click and your window-size selections will appear in
    the AppSizer "list" (that you set up) and can be selected there.
    But there is no re-scaling of the window contents, if that is
    what you mean, so the smaller window may now require scrolling.
    But keep in mind that if you use the recording option for
    "Software Simulation" > "Custom Size", you can then snap the
    application window to that size...

  • HT4489 this is ridiculous! how do you keep the size of the picture for a contact that small? it is usually a piece of  a lager picture... any way to make the size of the pictures the 224 KB they want? I always thought the application cropped the picture t

    this is ridiculous! how do you keep the size of the picture for a contact in the address book that small? it is usually a piece of  a lager picture... any way to make the size of the pictures the 224 KB they want? I always thought the application cropped the picture to fit their requirements...
    Help
    Leo

    Gem
    Events are organised strictly on date and time, as read by iPhoto from the Exif data in the Photo. You cannot manually sort.
    Create Albums. You can do much more organising with Albums, use Photos from different events, place them as you will. Best of all, Albums use no disk space at all. They simply reference the file on the Hard Disk. So a pic can be 1, 10 or 100 Albums with no wasted disk space whatever.
    Regards
    TD

  • Lightroom 5 make adjustments want to transfer to photo shop to make additional adjustments. how do you keep the adjustments made in lr5 when photo is transferred to photo shop

    lightroom 5 make adjustments want to transfer to photo shop to make additional adjustments. how do you keep the adjustments made in lightroom 5 when photo is transferred to photo shop
    I am not able to keep the changes made in light room when I transfer to photo shop

    Something you need to understand. Unless you are using the latest version of Photoshop Elements, it's possible that some of the adjustments that you make in Lightroom won't transfer to Elements if you choose the option to open anyway. If you choose the option to edit a copy with Lightroom adjustments then Lightroom will create a TIF or PSD file (depending on your preferences), and that file will include all of the adjustments that you have made using Lightroom. Then you can finish your work in Photoshop Elements.
    The process of transferring an image from Lightroom to Photoshop or Photoshop Elements involves the Camera Raw plug-in. It has to be used to interpret the Lightroom adjustments and apply those adjustments to the image after it has been converted. Files open in Elements or Photoshop or no longer raw images because those programs are incapable of editing raw image data. I don't know if this will help you in this situation. Feel free to ask if you have more questions.

  • How can you keep the highest iphone 4s Video quality the same when exporting it from iMovie.

    How can you keep the highest iphone 4s Video quality the same when exporting it from iMovie.

    InDesign's PDF export engine does not transcode your videos, they are embedded exactly as they were in the original file. The Flash Player runtime which displays video inside PDF files may not show a perfect match to Quicktime etc. because most video playback tools aren't designed for a color-calibrated workflow, but they should be close.
    The playback quality (blocking and aliasing) will be affected if the clip is not playing at 100% (screen pixels != video pixels) and in PDFs with the standard video player widget, that will only ever happen when you use 'floating window' mode. PDF pages have physical dimensions, so viewing them at "100%" does not make them match screen pixels.
    If you don't mind the video clip being smaller than the media annotation in which it's playing, then use my free upgrade to the Acrobat playback widget - VideoPlayerX - which maintains 1:1 pixel scale until the page is zoomed out too far for it to fit. You can install the widget into InDesign so it's used by default when exporting.

  • When playing songs in iTunes playlist, How do you keep the next song from jumping to next song? I am working on song list updating other tracks info and then the next song starts and I lose my spot in song list?

    When playing songs in iTunes playlist, How do you keep the next song from jumping to next song? I am working on song list updating other tracks info and then the next song starts and I lose my spot in song list?

    Max OSX 10.6.8, iTunes 11.1
    I had a similar problem: I wanted to synch my playlist to my iphone. I like to have my playlist sorted by genre. But under each genre, albums are not sorted by the track numbers. This is a problem, especially when I am listening to club mixes when the DJ smoothly transitions from 1 track sequentially to the next one. Under the properties of each audio file, the Track Numbers and Disc Numbers are already there.
    My perfect solution was to turn On Sorting - Sort Album under View>Show View Options. Then, select all the songs in that album (Shift click, Cmd click, etc) , and Edit multiple item information (Cmd I). You will see Info-Video-Sorting-Options buttons. Click on Sorting. Then, under Sort Album, Enter the name of the album. Then OK.
    You should now have the playlist sorted by Genre, then each album individually sorted by track numbers. On your playlist you should see, if you scroll right, the column added called "Sort Album".
    Hope this helps.

  • How do you change the order of the sections

    How do you change the order of the sections?

    Tap the little + symbol to bring up the Song Sections menu.
    Tap the Edit button.
    Press down on the three grey bars of the section you want to move and slide it up or down the list.
    Tap Done when you are, and then anywhere outside the Song Sections box to dismiss it.
    tt2

  • HT3215 How do you keep the clock face showing all the time without the screen going dark?

    How do you keep the clock face showing all the time without the screen going dark?

    Thanks.  I saw a number of answers to the same basic question after I posted my question and apparently there are ways to to keep it on but, as you said, it will drain the battery quickly.

  • How can you keep the caps lock on and not unlock after each letter?

    How can you keep the caps lock on and not unlock after each letter?

    I'm not aware of an online keyboard that is available and can do this. Most likely it would need to be a function of the app itself (which can and sometimes do add functionlaity to the keyboard).
    Wireless keyboard might handle that, if that's an option for you.
    I work in IT myself, and IMHO the iPad isn't the ideal device for coding or scripting work.

  • How do you keep the same URL connection connected continuously?

    I am trying to extract information from a web page, but it puts a cust_id in the middle of the URL. It generates the cust_id randomly everytime you use the site. I connect to the initial URL to find the cust_id, I substring that to the new URL and then make a new connection to extract the information, but the web page gives me an error saying that it doesn't recognise the cust_id. As if it was a new connection with the wrong cust_id.
    How can I keep the first connection open and with the same cust_id information and then jump to another web page but using the initial connection. Using IE6 I can just cut and paste the second URL and get to the page, but with my java application it doesn?t work. Please have a look at my code and let me know if I am doing anything wrong.
    URL inputURL;
         String inputLine;
         URLConnection connection;
         String page = "";
         int x;
         String cust_id1 = "";
         String cust_id2 = "";
         String site;
         File outputFile = new File("web.txt");
         FileWriter out = new FileWriter(outputFile);
       try
         inputURL = new URL("http://www-ets.woolworths.com.au/ets/owa/login?topage=search");
         connection = inputURL.openConnection();
         BufferedReader inputStream = new BufferedReader(new InputStreamReader(connection.getInputStream()));
         while ((inputLine = inputStream.readLine()) != null)
              page = page + inputLine;
              System.out.println(inputLine);
              x = inputLine.indexOf("cust_id=");
              if (x != -1)
              cust_id1 = inputLine.substring(x, x + 14);
              PrintWriter file = new PrintWriter(new FileOutputStream("web.txt"));
              out.write(page);
              out.close();
              System.out.println("1st time successful");
              System.out.println(cust_id1);
              //inputStream.close();
              //extracted the customer id, now able to search for the product
              //test for milk
         site = "http://www-ets.woolworths.com.au/ets/owa/items?search_pattern=milk&";
         site = site + cust_id1;
         site = site + "&imode=search&search_option=";
         System.out.println(site);     
         inputURL = new URL(site);
         BufferedReader inagain = new BufferedReader(new InputStreamReader(inputURL.openStream()));
         //tried the connection way
         //connection = inputURL.openConnection();          
         //BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
         while ((inputLine = inagain.readLine()) != null)
              //System.out.println(inputLine);          
              x = inputLine.indexOf("cust_id=");
              if (x != -1)
              cust_id2 = inputLine.substring(x, x + 14);
              System.out.println(cust_id1);
              System.out.println(cust_id2);
              System.out.println("2nd time completed");
              inputStream.close();
       catch(ArrayIndexOutOfBoundsException obe)
                System.out.println("Usage: FetchURL url");
       catch(IOException ioe)
                System.out.println("IO Exception");

    Please have a quick look at my code and see if I am doing anything wrong. I havent been able to set the correct cookies and the output html page comes up with an error saying that it could not retrieve my request. This time there is no mention of invalid cust_id.
              try
                   URL inputURL = new URL("http://www-ets.woolworths.com.au/ets/owa/login?topage=search");
                   connection = inputURL.openConnection();
                   System.out.println("filename = " + inputURL.getFile());
                   BufferedReader inputStream = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                   while ((inputLine = inputStream.readLine()) != null)
                        //System.out.println(inputLine);
                        page = page + inputLine;     
                        x = inputLine.indexOf("cust_id=");
                        if (x != -1)
                             cust_id = inputLine.substring(x + 8, x + 14);
                   out.write(page);
                   out.close();
                   System.out.println("extracted cust_id: " + cust_id);
                   for (int i = 1; i <= 30; ++i)
                        System.out.println("    Header " + i + ":  " + connection.getHeaderFieldKey(i) + ": " + connection.getHeaderField(i));
                        header = header + connection.getHeaderFieldKey(i);
                        header = header + ": ";
                        header = header + connection.getHeaderField(i);
                   outcookie.write(header);
                   outcookie.close();           
                   inputStream.close();          
                   //extracted the customer id, now able to search for the product
                   //test for milk
                   String url2 = "http://www-ets.woolworths.com.au/ets/owa/items";
                   //String url2 = "http://www-ets.woolworths.com.au/ets/owa/login?topage=search";
                   inputURL = new URL(url2);     
                   connection = inputURL.openConnection();     
                   connection.setDoOutput(true);
                   //connection.setUseCaches(false);
                   System.out.println("filename = " + inputURL.getFile());
                   String date = "; expires=Mon, 28 Jan 2002 02:53:17GMT; path/;";     
                   String date1 = "expires=Sun, 31 Dec 1989 14:00:00 GMT; path/;";
                   connection.setRequestProperty("cookie", "qwc=" + cust_id + date);
                   connection.setRequestProperty("cookie", "cust_id=" + cust_id + "; path=/;");
                   connection.setRequestProperty("cookie", "cd=2%40142%40%40%40%40N%40; path=/;");
                   connection.setRequestProperty("cookie", "state=NSW; path=/;");
                   connection.setRequestProperty("cookie", "dsd=1; path=/;");
                   connection.setRequestProperty("cookie", "sb1=0%2A%2D645746%2D0%2A; path=/;");
                   connection.setRequestProperty("cookie", "sb2=0; " + date1);
                   connection.setRequestProperty("cookie", "sb3=0; " + date1);
                   connection.setRequestProperty("cookie", "sb4=0; " + date1);
                   connection.setRequestProperty("cookie", "sb5=0; " + date1);
                   connection.setRequestProperty("cookie", "sb6=0; " + date1);
                   connection.setRequestProperty("cookie", "sb7=0; " + date1);
                   connection.setRequestProperty("cookie", "sb8=0; " + date1);
                   connection.setRequestProperty("cookie", "sb9=0; " + date1);
                   connection.setRequestProperty("cookie", "sb10=0; " + date1);
                   connection.setRequestProperty("cookie", "sbn=; path=/");
                   connection.setRequestProperty("cookie", "search=milk; " + date1);               
                   //connection.setRequestProperty("Content-type", "application/octet-stram");
                   //connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
                   //String parms = "?search_pattern=" + URLEncoder.encode("milk") + "&cust_id=";
                   //parms = parms + URLEncoder.encode(cust_id);
                   //parms = parms + "&imode=" + URLEncoder.encode("search") + "&search_option=";
                   //System.out.println("parms : " + parms);
                   String parms = "?search_pattern=milk&cust_id=";
                   parms = parms + cust_id;
                   parms = parms + "&imode=search&search_option=";
                   System.out.println("parms : " + parms);
                   PrintWriter outStream = new PrintWriter(connection.getOutputStream());
                   outStream.println("parms");
                   outStream.close();               
                   BufferedReader inputStream1 = new BufferedReader(new InputStreamReader(connection.getInputStream()));     
                   //BufferedReader inagain = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                   while ((inputLine = inputStream1.readLine()) != null)
                        //System.out.println(inputLine);
                        page2 = page2 + inputLine;
                        x = inputLine.indexOf("cust_id=");
                        if (x != -1)
                             cust_id2 = inputLine.substring(x + 8, x + 14);
                   out2.write(page2);
                   out2.close();
                   System.out.println("2nd attempt cust_id" + cust_id2);
                   for (int i = 1; i <= 30; ++i)
                        System.out.println("    Header " + i + ":  " + connection.getHeaderFieldKey(i) + ": " + connection.getHeaderField(i));
                        header2 = header2 + connection.getHeaderFieldKey(i);
                        header2 = header2 + ": ";
                        header2 = header2 + connection.getHeaderField(i);
                   outcookie2.write(header2);
                   outcookie2.close();      
                   inputStream.close();
              }The original web page to get the cookie is
    http://www-ets.woolworths.com.au/ets/owa/login?topage=search
    Enter a search product eg milk and that is the second page I am trying to extract.
    You will notice in the middle of the url is cust_id.
    Am I going about this 2 pages completely wrong?

  • How do you keep the ipad from deleting your e-mail messages immediatly

    How do you setup the e-mail to keep your ipad from deleting messages immediately.

    What do you mean by immediately?
    If you have a POP3 account go to Settings>Mail>the accounts>Advanced and you can select when to remove from server.

  • How do you keep the graphics looking sharp?

    Whenever I export a project the graphics always end up
    looking pretty bad. How can you maintain the crisp lines you get
    with vectors?

    fwitt wrote:
    > Why do the corners of any rectangle I draw look like
    this?
    >
    >
    http://img357.imageshack.us/img357/1581/image10kl6.jpg
    >
    > Everything is set to the highest quality.
    Never seen that before nor heard anyone else mention it in
    here.
    Can you give us some info on your specs and is there a chance
    to see
    the file ?
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • How Do You Control the Order That Menu Items Are Selected

    I am using iDVD 6 with the Portfolio Theme (iDVD 5). I created a project with one 15-minutes iMovie project and seven slideshows (created in iDVD).
    In Preview mode (or with the final) DVD, the order that entries on the main menu are selected does not seem to follow a logical pattern. As I try to advance using the right cursor, the second item (horizontally) is skipped. (I have two rows, each with four items). When I have one of the other three items in that row selected, the second item is selected if I hit the down arrow.
    In 'flowchart view' the eight items are in the order I want them to be selected. That is, the item that is being skipped is in the second position on the flowchart.
    Any insight on this would be appreciated.
    PowerBook G4 1.33 Ghz (me) & FP iMac - 1.0 Ghz (kids)   Mac OS X (10.4.4)   iMac (for the kids)

    I created an iMovie and then exported to iDVD, iDVD used the same sequence as the iMovie. When you build you Movie or slide show it follows the sequence that you place them in the time line. I have a Slide Show movie with video clips in the time line all of the shows and clips play in the order that I placed them. When you move through the menu use the right arrow to move accross the menu and the down arrow to move down to the next row. There is an button to move to the next menu. I have 13 chapters in my iDVD and they appear on 3 menus. Each menu shows 6 buttons you can edit the button titles and reposition them if you deselect the snap to grid and select the other option. When I open my project after exporting the titles overlayed each other. The buttons picted up my iMovie titles so I had to fix them and reduce the type size and move the buttons to separate them. The time line sets the order and the arrow keys move throgh the buttons on you Mac screen you can select with the mouse by clicking the button. On a DVD player you are stuck with the arrows and enter keys on the remote. You may have a glitch in your data check the time line along bottom of your original to see if the chapter markers are in position.
    Richard
    1.25 GHz Dual G4 Desk Top Mac OS X (10.4.6)

  • How can you keep the file name when using "Download Linked File As..."?

    I'm a longtime PC user finally making the transition to Mac.  Some of the tasks that seemed so simple in Windows have really stumped me!  One of the tasks I do frequently is download files into specific folders.  After much looking, I finally found the "Download Linked File As..." option if I right-click on the download link.  The problem is, when I choose this option, I lose the file name.  I get a window in which I can choose the desired folder, but the filename is always "0".  If I want to keep the filename (and I usually do), I have to type it in manually.  Is there anyway around this?

    You can post a screen shot by clicking on the liitle Camera icon above your reply.  :)
    Just checked on 10.7.4+, still the same, something is borked about your install, to see if we need to re-install...
    To find out if it's system wide or user specific, try this...
    Open System Preferences>Accounts, unlock the lock, click on the little plus icon, make a new admin account, log out & into the new account.
    Does it work in the new account?

Maybe you are looking for

  • Error while Deploying -- Please help !!!

    Hi, I am getting the following error while deploying. The components that I have is a html, servlet and Stateless session bean, basically I am executing chapter 2 of developing Enterprise applications "A Simple Session Bean". The error is as follows.

  • Ipod Nano not recognised as an iPod

    Hi, I have a fourth generation iPod nano, which today just started not working correctly. When inserted into my Mac, it will be recognized as a removable drive (with the name "noname" on the desktop, and it is not recognized at all in iTunes. I have

  • Can't target correct container for video in a Lightbox.

    I'm trying to embed a YouTube video into a Lightbox (ala, Katie's Cafe, which I did successfuly last week).  It just keeps showing up on the page, NOT in the right container. I have followed the directions about 20 times from the Katie's Cafe site, a

  • Price adjustment problem with gamers club unlocked

    I've been told i get the 20% from GCU when i do i price adjustment but i did not after giving a called to CSR earlier in the day. Basically i bought Little Big Planet 3 Day One Edition for $47.99 because that is the default price for me after GCU 20%

  • List display update

    Hi, I got a spark list component associated with an arraycollection data provider. This list must handle multiple selection and, when it is displayed, I do a check on the arraycollection and set the list selectedindices vector the indices I want to b