How to display the results of the database from several tables in descending order?

I have a key word to search for images on my website that allows visitors to search for specific things. My db msysql has 15 tables and for the search function I use a UNION ALL operation to join them any visitor can find all tables at the same time. The problem is that all the results are in ascending order. How can I get the results in descending order.

SELECT *.

FROM table1

Keyword WHERE AS id LIKE %s or %s

UNION ALL

SELECT *.

FROM table2

Keyword WHERE AS id LIKE %s or %s

UNION ALL

SELECT *.

TABLE 3

Keyword WHERE AS id LIKE %s or %s

PS

I tried this and it doesn't work:

SELECT * FROM table1 WHERE AS %s or id AS %s ORDER BY id DESC keyword

and I know that this is not conventional to use SELECT * with so many tables, but believe me, I have my reasons. I'm not trying to do is to wrap the whole UNION within an external SELECTION

Once more, the order by clause can only appear at the end of the last select statement in a UNION query. You have it on all select statements.

Tags: Dreamweaver

Similar Questions

  • How to display the database column value in a component of choice selected?

    Hello everyone;

    I use Jdeveloper 11.1.1.4 and right now I have the .jspx UI page that includes < af:selectonechoice / > components and according to the requirment I have to fill one of the column in the table in this drop-down list.

    can someone tell me how to fill the database column value in this drop-down list. I know I need to create the VO for the same thing, but I'm new to this technology. Then please suggest.

    Thanks in advance.,

    This will help u

    https://blogs.Oracle.com/prajkumar/entry/create_lov_in_adf_application

    How to create LOV in ADF 11 g | Techartifact

    Oracle Fusion Middleware Technologies: 11G: how to create a list of Values (LOV)?

    http://www.baigzeeshan.com/2010/03/creating-lov-in-ADF-application.html

    http://husaindalal.blogspot.de/2010/05/How-to-default-lov-with-its-first-value.html

  • * How to display the group from the main query for the first time in the report?

    Hello

    I have developed a group of master / detail in a report
    The master has its extensible framework and the detail of one another framework extensible and put to another page in the page layout.
    The problem is that the master one appears (the same record) in the pages in time equal the number of records in detail that is specific for this master record!
    Example:
    If the master record got three Details then database will show three times (three pages) and then running page number 4 will display the three detail records.

    How to make the master data in shown only for once (page number 1 only) and then display the details three records to the next page (page number2) at run time?

    Hello

    the question is, what you've done for this. By default the primary record is displayed only once. Could it be, that the master-fields are inside the extendable frame for more details?

    Concerning
    Rainer

  • How to activate the database from Enterprise Manager Grid 12 c EBS 12.2.5

    Hello

    I have a question how do I activate the enterprise Grid Control on the 12 c database manager.

    Now, I was demanding to activate the database of EM 12 c on EBS 12.2.5 grid control. Already tried to emca, but showed nothing to configure?

    Please help me how to activate this feature?

    Thank you

    Andreas Kuncoro

    Hi Christophe,

    Thanks for your info. I already activate.

    Thank you.

    for retail, the step:

    Enable Enterprise Manager on Oracle E-Business Suite with database 12.1.0.2

    Concern about the listener and the database only.

    1. check the listener

    $ cd $ORACLE_HOME/network/admin/VIS2_miiexa01 /.

    $ more tnsnames.ora

    ###############################################################

    #

    # Do not change the settings in this file manually. They are managed

    # automatically and will be overwritten when executing automatic configuration.

    # For more information about automatic configuration, see the Oracle

    # E Business Suite Installation Guide.

    #

    $Header #: NetServiceHandler.java 120.28.12020000.6 2014-05-14 07:55:23 mmanku ship $

    #

    ###############################################################

    VIS2 =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = tcp (PORT = 1529))(HOST=miiexa01.vision.co.id))

    (CONNECT_DATA =

    (SERVICE_NAME = VIS2)

    (INSTANCE_NAME = VIS2)

    )

    )

    VIS2_FO =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = tcp (PORT = 1529))(HOST=miiexa01.vision.co.id))

    (CONNECT_DATA =

    (SERVICE_NAME = VIS2)

    (INSTANCE_NAME = VIS2)

    )

    )

    VIS2_LOCAL =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = tcp (PORT = 1529))(HOST=miiexa01.vision.co.id))

    )

    VIS2_BALANCE =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (LOAD_BALANCE = YES)

    (FAILOVER = YES)

    (ADDRESS = (PROTOCOL = tcp (PORT = 1529))(HOST=miiexa01.vision.co.id))

    )

    (CONNECT_DATA =

    (SERVICE_NAME = VIS2)

    )

    )

    VIS2_REMOTE =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = tcp (PORT = 1529))(HOST=miiexa01.vision.co.id))

    )

    )

    VIS2XDB =

    (DESCRIPTION =

    (ADDRESS =

    (PROTOCOL = tcp)

    (HOST = miiexa01.vision.co.id)

    (PORT = 1529)

    )

    (CONNECT_DATA =

    (SERVICE_NAME = orcl12XDB)

    )

    )

    extproc_connection_data =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROCVIS2))

    )

    (CONNECT_DATA =

    (SID = PLSExtProc)

    (PRESENTATION = RO)

    ) )

    IFile=/Home/VIS2/12.1.0/Network/admin/VIS2_miiexa01/VIS2_miiexa01_ifile.ora

    2. check the database

    $ sqlplus / as sysdba

    check port https already set to EM

    SQL > SELECT 'https://'|| SYS_CONTEXT ('USERENV', 'SERVER_HOST') |'. ' || SYS_CONTEXT ('USERENV', 'DB_DOMAIN') |': ' | dbms_xdb_config.gethttpsport () | "/em/' double.

    SQL > SELECT 'https://'|| SYS_CONTEXT ('USERENV', 'SERVER_HOST') |': ' | dbms_xdb_config.gethttpsport () | "/em/' double.

    using the https protocol to open a session on EM

    SQL > exec dbms_xdb_config.sethttpsport (5500);

    Changeinit .ora

    $ viinit .ora

    Add the new line oninit .ora

    Dispatchers = "(Protocol=TCP) (SERVICE =XDB)" "

    Restart the database for changes in the init.ora file take effect.

    SQL > show the extreme setting

    VALUE OF TYPE NAME

    ------------------------------------ ----------- ------------------------------

    chain of dispatchers (PROTOCOL = TCP)(SERVICE=VIS2XDB)

    whole MAX_DISPATCHERS

    SQL > exit

    Thank you

    Andreas Kuncoro

  • How export/import the database from the Tools menu in sql developer.

    Hello

    I need to export the database to a server and import it on another server db using the export function of database under the Tools menu in SQL developer. How to import it? This is for Oracle database 10g.

    Thank you

    Hello

    You can do it, but I do not recommend because sqldeveloper could eat all the memory of the system to analyze the script. Now the question is do you have also opted for storage option when you export, if yes make sure that similar tablespace exists or available in env b. Also if you want to use the generated sqldeveloper file you can run this file from sqlplus session

    sqlplus newuser/password
    sqlplus > @myexport.sql

    But my advice or suggestion or recommendation to be, you should consider using export/import or datapump but the decision is yours. Hope this helps

    Concerning

  • How to extract the indictments of several tables

    Hi all

    I have 10 tables that all have the same columns, but different data in each column. I would like to get a count of how many fields is not null for a specific column in each table. I tried to figure this out for hours without success. We use oracle 10g and I use Toad to write my SQL.

    I will try to give you an example.

    The SQL below returns the numbers for one of the tables. I would like to get the counts for each table with a single query.

    SELECT COUNT(*) FROM RRM_HOME_EQ
     WHERE unit_id is not null
     AND   account_off is not null;
    

    Thanks in advance

    OR

    Try as below...

    Select (select count (*) from emp where deptno = 10) tab1, tab2 (select count (*) of the Department)

    Double;

    TAB1 TAB2

    ---------- ----------

    3          7

    Hope this helps... !

  • How to display the records from a query in the non-base data field

    Hello

    I have a problem:
    I have a query with a lot of tables and column 6 (select a, b, c, d, e, f x, y, z, t, s, g where the conditions) and I use 3 parameters.
    I create 3 settings: datai,: dataf and: partner and a button with a trigger when the button is pressed.
    Then a create a block manually with six field non-database a1, b1, c1, d1, e1, f1.
    Now, I want to display all the records in my query in a1, b1, c1, d1, e1, f1 where a1 = a, b1 = b, etc. and all the records (if I have 20 record, it will display 20 records in the non-base data field) when I press the button.

    How I did it:
    I create a cursor with the query, and then
    start the open cursor
    loop
    Fetch cursor in: a1,: b1,: c1: d1: e1,: f1;
    end loop;
    close the cursor;
    end;

    It displays a single record in a1, b1, c1 only, and it must display 100 records and date for all fields.

    Can someone help me with this problem?
    Thank you.

    Published by: 928437 on October 1, 2012 02:55

    Creating a view and the query in a database block are a great solution.

    To use the block non-base of data:
    You are missing the most important Next_Record; command.

     Begin
    Go_block('X'); -- block X is the non-database block
    Clear_Block(No_Validate);
    open cursor X1;
    loop
    If :System.Record_status != 'NEW' then
    Next_Record;
    End if;
    fetch X1 into :a1,:b1,:c1,:d1,:e1,:f1;
    Exit when X1%NOTFOUND;
    end loop;
    close X1;
    end;

  • How to display the rows dynamically in Table Adv

    Hi friends,

    I created a custom page its an insert page, user must enter details of employees and save on db, there is a field of messageInput, where the user will enter the number of lines to dsiplay. so that the user will enter details.
    for example: If the user enters 20, so the advanced table should display 20 ranks, if the user enter 30 then advanced table should display 30
    is it possible to script?

    Hello
    It should be possible,
    create a table advanced based on a VO and it should be based on an OA.
    Then get the number of records to be added, once the user click on the button

    run the EO based VO with 1 = 2 condition and then create several lines user number entered in a loop for,.
    and then set the cursor to the first line.

    Your advanced table should have the newly created (empty lines) ready for users to input.

    Once the user enters the values, you can do a commit which will record your data.

    Thank you

    With respect,
    Kali.
    OSSi.

  • Migrate the database from standard edition to enterprise edition.

    Hello

    We use oracle 10.2.0.4 on AIX 5.3.

    We lack some databases on the standard edition, now we need to migrate these databases to enterprise edition,

    What are the steps to do it?


    Thank you.

    Salvation;

    Please find below the doc:
    How to convert the database from Standard to Enterprise Edition? [117048.1 ID]

    Respect of
    HELIOS

  • How to display the result sqlplus in java?

    I want to call sqlplus to run some commands sql in java, but how can I print the result of sqlplus?

    In java code, I call sqlplus as:

    Process of p;
    Run the command
    p = Runtime.getRuntime () .exec (commandString);
    print the result of the command
    InputStream inputStream = p.getInputStream ();

    How to display the result of the execution?

    Published by: Yi on February 26, 2012 23:41

    You can use ProcessBuilder. Copy the following code starts sql * more and runs the script in the variable "filename". It displays the results in the console of NetBeans.

    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.File;
    import java.util.Map;
    
    public class test1 {
    
        public static void main (String args []) {
    
            test_script();
        }
    
        public static void test_script () {
    
            String fileName = "@test_table.sql";
            String sqlPath = "E:\\";
    
            String sqlCmd = "sqlplus";
    
            String arg1   = "user/password@sid"; -- plug in your user, password and db name
            String arg2   = fileName;
            try {
                String line;
                ProcessBuilder pb = new ProcessBuilder(sqlCmd, arg1, arg2);
                Map env = pb.environment();
                env.put("VAR1", arg1);
                env.put("VAR2", arg2);
                pb.directory(new File(sqlPath));
                pb.redirectErrorStream(true);
                Process p = pb.start();
              BufferedReader bri = new BufferedReader
                (new InputStreamReader(p.getInputStream()));
              BufferedReader bre = new BufferedReader
                (new InputStreamReader(p.getErrorStream()));
              while ((line = bri.readLine()) != null) {
                System.out.println(line);
              }
              bri.close();
              while ((line = bre.readLine()) != null) {
                System.out.println(line);
              }
              bre.close();
              System.out.println("Done.");
            }
            catch (Exception err) {
              err.printStackTrace();
            }
    
        }
    
    }
    

    Here is the content of the script at E:\\test_table.sql

    Prompt drop TABLE ANOTHER_TEST;
    DROP TABLE ANOTHER_TEST CASCADE CONSTRAINTS
    /
    
    Prompt Table ANOTHER_TEST;
    CREATE TABLE ANOTHER_TEST
    (
      BATCH_SEQ             NUMBER,
      BATCH_GROUP_ID        NUMBER,
      STATUS_FLAG           VARCHAR2(30 BYTE),
      OBJ_BEING_PROCESSED   VARCHAR2(80 BYTE),
      BATCH_RUN_START_DTTM  DATE,
      BATCH_RUN_END_DTTM    DATE,
      CREATE_DTTM           DATE,
      CREATE_USER           VARCHAR2(30 BYTE),
      UPDATE_DTTM           DATE,
      UPDATE_USER           VARCHAR2(30 BYTE)
    )
    LOGGING
    NOCOMPRESS
    NOCACHE
    PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT )
    MONITORING
    /
    
    COMMENT ON TABLE ANOTHER_TEST IS 'This is a test table.'
    /
    
    EXIT
    /
    
  • How to display the serial No. field not to mention that the search results displayed

    How to display the serial No. field not to mention that the search results displayed

    Hello

    You missed to add the varstatus property in your table

    Try with this code:


    lines = ' #{bindings. " SahajDetailVO1.rangeSize}.
    emptyText = "#{bindings." SahajDetailVO1.viewable? "{'No data to display.': 'Access Denied.'}".
    fetchSize = "#{bindings." SahajDetailVO1.rangeSize}.
    rowBandingInterval = "0" id = "t1" styleClass = "AFStretchWidth."
    varStatus = 'vs' >



  • How to display the results in the order based on the value of research

    Hi all

    How to display the results in the slot order.
     
    
    CREATE TABLE TEST( SONGID  NUMBER, TITLE   VARCHAR2(200))
    
    INSERT INTO TEST(SONGID,TITLE) VALUES (10,'AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (11,'CICCONE, MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (12,'DALLIN, MADONNA LOUISE/STOCK');
    INSERT INTO TEST(SONGID,TITLE) VALUES (13,'MADONNA');
    INSERT INTO TEST(SONGID,TITLE) VALUES (14,'MADONNA (A)/ AHMADZAI, MIRWAIS (C)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (15,'MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (16,'MIRWAIS AHMADZAI, MADONNA');     
    INSERT INTO TEST(SONGID,TITLE) VALUES (17,'MIRWAIS (CA)/ MADONNA (CA),AHMADZAI');
    INSERT INTO TEST(SONGID,TITLE) VALUES (18,'MADONNA (CA),CICCONE');
    
    SELECT *FROM  TEST WHERE INSTR (TITLE, 'MADONNA') > 0
    
    output: 
    SONGID     TITLE
    10     AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
    11     CICCONE, MADONNA (CA)
    12     DALLIN, MADONNA LOUISE/STOCK
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    16     MIRWAIS AHMADZAI, MADONNA
    17     MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
    18     MADONNA (CA),CICCONE
    
    Expected output :
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    18     MADONNA (CA),CICCONE
    ..
    ..
    ..
    ..
    ...
    If the user makes a search with "MADONNA", I view the results as title begins with "MADONNA" first then the rest of the records.
    Please let me know is possible to show the results in this order.


    Kind regards
    Rajasekhar

    This can be a little more specific:

    SQL> SELECT *
      2  FROM   TEST
      3  WHERE  INSTR (TITLE, 'MADONNA') > 0
      4  ORDER  BY INSTR (TITLE, 'MADONNA')
      5           ,TITLE
      6  ;
    
                  SONGID TITLE
    -------------------- --------------------------------------
                      13 MADONNA
                      14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
                      15 MADONNA (CA)
                      18 MADONNA (CA),CICCONE
                      12 DALLIN, MADONNA LOUISE/STOCK
                      11 CICCONE, MADONNA (CA)
                      17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
                      16 MIRWAIS AHMADZAI, MADONNA
                      10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
    
  • How to display the speaker icon in the taskbar in windows 7?

    How to display the "speaker" of the taskbar icon in windows 7?

    Thank you

    concerning

    Jamal

    Hi Jamal

    1. right click on the taskbar, and then select Properties.

    In the Notification area section, click the Customize button.

    2. in the Configuration window, find the Volume icon.

    The Drop Down Menu to select the icon lounge and Notifications.

    3. If you don't see the Volume icon, click system icons activate or deactivate the link at the bottom of the window.

    Find the Volume icon and select enabled in the menu dropdown.

    Repeat step 2.

    Let us know the results.

    Concerning

  • How to display the list item values both from 2 different tables?

    Hello world.

    I have a problem for the display of the data.

    There are 2 tables in the database.

    Table-1 has lc_value, lc_no, lc_dt, and vendor_code columns.

    Table-2 has vendor_code, $vendor_name & vendor_address.

    I created the form where I display data in list item 30 (tabular presentation - 30 records displayed).

    I need to display all values automatically at the same time in the form just by clicking on "Enter_Query" and "Execute_Query".

    It worked when the form had fields in a table in a single table.

    I created fields in a table for tables; then created the relationship between the tables by using the join (vendor_code).

    But when I run the form, click on "Enter_Query" and "Execute_Query", its does not work.

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production.

    How can I do this?

    Help me.

    Thank you.

    Dear Bruno,

    Each provider code is to have a folder, then

    Why keep two tables?

    Why you want to update both the table at the same time?

    Master / detail means,.

    a master record depends on several detail records.

    Please, understand and try to build your form with single table.

    If you have already created 2 tables, then merge these into a single table.

    Or other wise keep table_1 as a database block and to vend_name as a data field (element of database in the palette of the property is set to 'no').

    Then go to the trigger of table_1 block post_query and write the following:

    Select vend_name in: vend_name from vendor_mst where vend_cd =: lc_vend_cd;

    In doing the above, the form will look as you wish but the change on the vend_name not to be saved because that is the point of no database.

    Other than vend_name all fields in table_1 will be recorded.

    Hope this will help.

    Post edited by: Priyasagi

  • How to display the width of the page or the big screen in firefox 11 automatically?

    How to display the width of the page or the big screen in firefox 11 automatically? I know how to Ctrl +, ctrl - and ctrl 0, but is there a way to define 11 firefox to automatically set the page viewing by default "page width" or full screen (F11 not)?
    Help, please. Thank you.

    You can use an extension to set a page zoom and the size of the default font on the web pages.

Maybe you are looking for