Order by "piece of a name"

Hello,
I was wondering if it would be possible order sql results
from a mysql database by a piece of a name. For instance, all the
product names that contain "red" should come first such as:
Red Flashligh deluxe or Redundant lights or whatever. I have
good seo reasons to do this automatically, but i do not know how.
It would have to look something like this:
SELECT *
FROM products
ORDER BY Productname (WHEN IT CONTAINS "RED") ASC

SyKeSnr1 wrote:
>
quote:
Originally posted by:
bregent
> >There might be other ways of doing this, but a very
simple approach
> >would be to use two recordsets:
>
> Using that approach, he could also try using a UNION to
combine the query
> results.
>
>
> Isnt there something like:
>
> Order by LIKE '%red%' First and then NOT LIKE '%red%'
>
> Or something simple and efficient like that? If not, is
there a way to
> manually (by for instance giving the sql code 9 product
id's) get 9 handpicked
> products on the top of the list first and then the rest?
This would also be an
> alternative for me...
Add another column into your database called order, default
it 0, then
once you have 0 set for all your records, change the top 9 to
have a
number higher than 0.
Then you:
ORDER BY order DESC, Products
That way you get all your top products at the top, and the
rest will be
in normal alphanumeric order.
Or, you could set all records to 1, then set the top ones to
0
and
ORDER BY order, Products
Either will work. If you go with the first one the record
with the
highest order will be first.
Steve

Similar Messages

  • What's the purchase order agreement master data table name?

    hi experts
    what's the the purchase order agreement master data table name? and by the way tell me some relative table about agreement.
    thanks a lot and hunger for ur advice.

    Hi,
    EKKO is the purchase order master table. EKPO is the item table. EKBE is purchase order history table. EBAN is purchase requisition table. EBKN is purchase requisition account assignment table.
    Reward.

  • Why, when I enter an order of pieces on my iTune playlist, when I burn that list, the order changes?

    Why, when I enter an order of pieces on my iTune playlist, when I burn that list, the order changes?

    Any more information?  Is this how you are seeing it in iTunes, or on a different player?  What kind of CD?  Standard audio?  MP3-CD?
    iTunes: How to set the play order of songs on an MP3 CD - http://support.apple.com/kb/HT2455
    The apparent order of a burned CD may depend upon how you have iTunes display it - https://discussions.apple.com/message/17827921 and https://discussions.apple.com//message18583827

  • How to view photes in order of time taken or name?

    Hello, I've transferred photos from my PC, (Windowa XP) in which I can view them in order of their names. All have date-time when photographed.
    Can I view photos on my IPAD in an order of their dateq/time when photographed?
    Thanks,
    Dudufr.

    If they are appearing in name order then I assume that you must still be on iOS 3.1, in iOS 4+ they will be displayed on the iPad in order of capture date. The only way to change the sort order (if not on a Mac and therefore not able to use iPhoto or Aperture to sort and sync) is to manipulate their capture dates on your computer and re-sync : http://support.apple.com/kb/HT4221

  • Order query depending on column names passed at runtime

    Hi
    Can any one suggest how to order by at run time depending on column name passed as parameter.
    create or replace procedure dummy_proc( p_orderby varchar2,p_refcursor out sys_refcursor)
    is
    begin
         open p_refcursor for select * from
         emp where Status='A'
              order by (select p_orderby from dual);
    end;
    --execution part for testing
    declare
         v_outcursor sys_refcursor;
         v_rec_data emp%rowtype;
         v_cnt number;
    begin
         dummy_proc ('ename,sal',v_outcursor);
         begin
              loop
                   fetch v_outcursor into v_rec_data;
                   v_cnt:=v_outcursor%rowcount;
                   exit when v_outcursor%notfound;
                   dbms_output.put_line('empno '|| to_char(v_rec_data.empno));
                   dbms_output.put_line('empno '|| v_rec_data.ename);
              end loop;
         end;
         dbms_output.put_line('Count is'|| to_char(v_cnt));
    end;
    we do not want to something like below as my actual query is very big with union statements and case expressions, (below is just an similar example)
    how i tried to order by but its not working.
    v_sql='select * from emp where empno= '|| p_empno || ' order by '|| p_orderby;
    open p_refcursor for v_sql;
    Thanks in advance
    Vishal

    we do not want to something like below as my actual
    query is very big with union statements and case
    expressions, (below is just an similar example)
    how i tried to order by but its not working.
    v_sql='select * from emp where empno= '|| p_empno ||
    ' order by '|| p_orderby;
    open p_refcursor for v_sql;I agree, you really don't want to do that, you want to use BIND VARIABLES.
    v_sql := ' select * from emp where empno = :bound_empno order by :bound_orderby';
    open p_refcursor for v_sql using p_empno, p_orderby;
    [pre]
    The size of the statement shouldn't come in to play, if the only dynamic portion of it is the order by clause then declare a constant which is the large query (you can use a LONG datatype) and then concatenate in the order by clause before you return the reference cursor.
    Unless you can give a legitimate reason for why you cannot use Dynamic SQL (not why you do not want to use it) this would be my approach.
    And please, if you don't know what a bind variable is...read about them, or your system will suffer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can I pick up a pre order made with my sisters name / number??

    Simple question. I made two pre orders, both under my sisters phone number and name. Do I need to be with her when I pick up the games.

    Hey Mrlaedis,
    Evolved is correct: the person whose name is listed on each pre-order is the only person who can pick those items up. The only exception to this would be if you placed both orders on BestBuy.com for store pickup and designated yourself as a Friends & Family pickup option at the time of checkout. For more information though I'd encourage you to refer to our pre-order FAQ:
    BestBuy.com > Help Center > Pre-Orders
    http://bbyurl.us/Preorders
    Let us know if you have any other questions.
    Aaron|Social Media Specialist | Best Buy® Corporate
     Private Message

  • I want to print my iTunes library of songs in name of song alphabetical order I tried hitting on name but it printed in artist alphabetical order?

    I Want to PRINT my iTunes library of songs in Alphbetical Name of song order, I have tried hitting on name but it prints out in artist alphabetical order???  Please adivise me on this issue

    - Try looking at the previous discussions on the right side of this page under the heading "More Like This".
    - Also try posting in the iTunes forum.

  • Order Details Issue - No Product Name Displayed

    Hi,
    I have a problem/issue on the Orders section, I can't see the Product Name bought by the Customers. Under the Order List, I can see the list of Customers who order to the checkout form and when I checked the order detail section there's no Product Name/Detail, I can only see the Shipping Option and Total Price. Also the Payment Status is Success.
    Please check if you can help me with this problem.
    Here's the site URL : http://misscocky.isinproduction.com/womens/shirts-and-tops
    By the way, this issue happens on all customers who ordered the checkout form and all products have its own name/title.
    Thanks

    Hi alfe,
    This looks like a bug. The order details should never look like this. Please reach out to support.
    Cheers,
    -mario

  • Images on iPad started to mix album's pages order since last sync,the names order are correct I've tried to erase and put back album's but got worse because it failed to write some. I would like to avoid to ripristinate the iPad.

    ciao, I've got some problema with my Image reader app. Since last sync it started to mix pages order, pages that are correctly nominated and were dispalyed in the correct order since the last sync.  unfortunatelly I haven't a backup and I would like to avoid to ripristinate it as I would loose my App documents. I have already tried several time to erase all my albums and putting back, but it got worse and it fails to copy some albums. What can i do?

    Since your intention was to sell legit software, I'm sorry that you were as much a victim as your buyers were.  I don't know what else you could do except report it as others have suggested and pay your customers back.  Companies like Adobe don't have the resources to follow up on every individual case of piracy, but they should be interested in tracking down the sources of the big professional counterfeiting rings.  Judging from your description of the packages you sold and the cost of producing such packages, I assume they come from such a source.
    function(){return A.apply(null,[this].concat($A(arguments)))}
    I'm from Seattle, so I didn't really think twice when the seller told me their source was a person who worked at Microsoft and had access to the "Microsoft store" (which is somewhat infamous here because of how cheap you can get software for if you have access). 
    I don't get the connection - you were selling Adobe software, not Microsoft software.

  • The order is under my dads name and he will not be here to give his signature, (he is going to be here the next day though) are they going to come the next day and see if he is here or do we have to go pick it up somewhere? iPod touch

    Im not sure, if anyone knows please let me know , thanks!

    Generally, they will accept a signature from anyone at the delivery address (unless the person is obviouslly under age).
    For example, I frequently have stuff delivered to work, and the mail room signs for it, then I pick it up from the mail room later in the day (such as a package I'm having delivered tomorrow).
    It is also possible to contact the shipping service and pre-sign so they will leave the package.

  • Report for Production orders with name of Customers

    Dear Expert,
    Kindly suggest to view the production orders with customer numbers for which the sales orders is created.
    I tried in MB51 with layout settings but the customer number comes out be blank despite the sales order number is populated for an production order.
    Kindly suggst a way or any report in the system  to get the corresponding information of production order number and corresponding customer name mentioned in the sales order .
    Thanks in advance for your help and inputs..
    Best regards,
    Nitish jain

    Nitish,
    MB51 is a Material Document list.  Many production orders exist that have no entries in this report, so it would be an unlikely candidate to be a solution for your requirement..
    The standard production order reporting tool is COOIS.  The output for MTO orders can be configured to display Sales order and Item and Soldto.
    Obviously, displaying even the customer order number in COOIS is impossible in a MTS scenario.
    In addition, a user experienced in using SAP Query  (SQVI or SQ01/SQ02/SQ03) could also create a production order report without having to know ABAP, by properly linking tables AFKO, AUFK, AFPO (production order data) with VBAK (sales order header data) to get customer number, and KNA1 to get customer name..
    If you are not expert in SAP Query, I suggest you discuss this requirement with a local ABAPer.
    If you are feeling like educating yourself in the wonders of SAP query, try this doc.  Although old, SAP query hasn't changed very much since this document was written.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
    Rgds,
    DB49
    Edited by: Dogboy49 on Apr 20, 2010 10:47 PM

  • How to Get Albums in File-Name-Order Photo

    When I updated my iPod Touch to V4.0 and iTunes (V9 on Windows XP) re-synced it, I found that my photo albums were now in Picture Date order rather than PC file name order. I tried several things that didn't work.
    What worked was using the Photoshop Essentials Organizer to change the picture date on all the photos in an album to the same date and time (this can be done to all selected photos in one operation).
    I did the sync in two steps. First I moved the album out of the iTunes photos directory and then synced my iPod which deleted the album. Then I moved it back and re-synced.
    Does anyone know of an easier trick? I’ve already submitted a feedback item to Apple that they should make file-name-order an option in iTunes
    Andy…

    The trick that I used is to append the URL with the name of the file. So if your url is "http://domain.com/attach", use "http://domain.com/attach/filename.doc". IE and Netscape parse the URL to determine what the filename is, so by placing this text at the end, you essentially let the browsers know what the filename is. :)
    I have design a program to get the attach file from an
    attachment. But when I click the link to save the
    file, the default name of the file is 'attach'
    whenever I get different files. Who know what is the
    problem, please tell me the truth.
    Here are some codes of the program.<< snip >>

  • E52 BT caller name order

    I'm having a problem with caller name and phonebook display when using E52 with Audi Bluetooth MMI - the order of first and last name is reversed, so the car display shows LAST, FIRST instead of FIRST LAST. The interesting thing is the good old 6300 works fine. Is there anything I can do (besides editing all contact entries)?
    Thanks!
    Message Edited by jure on 16-Nov-2009 10:06 PM

    Check for duplicates in the contact list.
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • Purchase Order BP Name issue

    Hi Experts,
                     The user has created Purchase Order for item in which the user has pulled vendor name from BP. But in BP  the vendor name is perfect given but in Purchase Order it shows wrong vendor name. I found difficult to update purchase order. Please guide me in this.

    Hi Shailesh......
    The problem is coming just because user has manually typed the BP name at PO level and not taken directly from BP Master.
    They should not allow to manually type BP Name as it comes directly from BP Master......
    Regards,
    Rahul

  • Sales order Header data require mandatory to fill Name of individual Who fo

    Hello,
    While creating OR sales order, it require to fill "Name" of Orderer & can not save order.
    I believe it is due to Incompletion log Header data Procedure 11Field "Name" assigned Status 01-->Which is general
    If I want to remove this, what is procedure?
    Or SAP standard requires this? Please suggest input.

    Hi Experts,
    I set Free Goods determination Inclusive Calculation Rule 1=Pro Rata and Cal Rule 2=Unit reference both are working fine.
    When trying for cal Rule 3 it gives error message "The system determined free goods with quantity 0 for item 000010
    Means for 10Ton of A product 10% means 2To are free. If I apply quantity in multiple of 10 i.e.10, 20 30 free goods are determined, delivery & billing is working well.
    But if I apply 25Ton or 38ton, it is not even giving minimum discounts say for 25ton, it should give atleast 20ton equivalent fre goods.  I checked in rounding rule OB90 where my company code3000 is giving 10 2 digit for USD currency. I set like this. When I checked pricing for condition type R100 it says requirement 055 not fulfilled. However I have maintained Req 055 & BaseType 28 in pricing procedure.
    For cal rule 3 what else setting I should check.
    Early reply with detail steps shall be highly appreciated.
    Thanks

Maybe you are looking for

  • Drivers/Help for HP LaserJet 1022 for Windows 7 (64 bit)

    I have a LaserJet 1022 which doesn't work with recently upgraded Windows 7 (64 bit). I downloaded  the drivers from the site, but the printer properties in Windows says that it doesn't need drivers, yet it doesn't appear in my list of printers when I

  • Invoice not getting created in ECC 6.0

    SRM Classic Scenario 5.0 and ECC 6.0 as backend. ECC6.0 is where all purchase documents are created Started invoice posting from SRM and it gets posted in ECC 6.0. Our FI data is maintained in ECC. When we are trying to create Invoice from SRM and ID

  • BB Link thinks it has a WiFi connection so backup won't run

    Summary: BB Link thinks that it has a WiFi connection when WiFi is switched off and phone is connected by USB. Computer: Dell E5550 OS Win 7, SP1, 64 bit. Link 1.2.3.56 Phone: BB Q10, OS 10.2.1 Problem: The phone is plugged in to a USB port and the c

  • Purchased movies after hd-crash gone

    How can I get my purchased movies back in German iTunes-Store after hd-crash?

  • Error simulating Part 1 in (j1iex) without order reference.

    Dear All              Error while simulating part 1 for sto in j1iex without order reference. "PLA -AT2 amount (30.09.08)is greater than available amount" please resolve this pblm.. Regards Senthil