A CSA column and one another desc

Dear all,

Could you please help me out on the underside.

I have a data like this

col1 col2
a 10
b 20
c 30
d 40

I would like to get the result that

col1 col2
a 40
b 30
c 20
d 10

My trial, but no luck.

with t1 as

(select col1, col2 10 double ' a'

Union of all the

Select col1, col2 20 double ' b'

Union of all the

Select 'c' col1, col2 30 from dual

Union of all the

Select would be ' col1, col2 40 double)

Select col1, col2 from t1 by 1 asc, desc 2;

/

Thank you

Hello

Thus, the values on the same line in the result set are not (in general) the values on the same line in the table, is that correct?  If so, that's what I call a query fixed price, and here's a way to do it:

WITH got_nums AS

(

SELECT dname, deptno

ROW_NUMBER () OVER (ORDER BY dname) AS dname_num,

ROW_NUMBER () OVER (ORDER BY deptno DESC) AS deptno_num,

OF scott.dept

)

SELECT na.dname

no.deptno

OF got_nums na

Got_nums to JOIN no ON no.deptno_num = na.dname_num

ORDER BY na.dname_num

;

As you post your table, I used the scott.dept table to illustrate.

The relevant raw data of scott.dept are:

DEPTNO DNAME

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

10 ACCOUNTING

SEARCH 20

30 SALES

40 OPERATIONS

and the results I get from the above query are:

DEPTNO DNAME

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

40 ACCOUNTING

30 OPERATIONS

SEARCH 20

SALES 10

Tags: Database

Similar Questions

  • I have a column with two values, separated by a space, in each line. How to create 2 new columns with the first value in a column, and the second value in another column?

    I have a column with two values, separated by a space, in each line. How do I create 2 new columns with the first value in one column and the second value in another column?

    Add two new columns after than the original with space separated values column.

    Select cell B1 and type (or copy and paste it here) the formula:

    = IF (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')

    shortcut for this is:

    B1 = if (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')

    C1 = if (Len (a1) > 0, Member SUBSTITUTE (A1, B1 & "", ""), "")

    or

    the formula of the C1 could also be:

    = IF (Len (a1) > 0, RIGHT (A1, LEN (A1) −FIND ("", A1)), "")

    Select cells B1 and C1, copy

    Select cells B1 at the end of the C column, paste

  • How to perform an addition of column values in an insert query that would insert in the 3rd column, and the values how to insert into another table.

    I have two tables (2) RESULT TAB (1)

    CREATE TABLE TAB

    (

    NUMBER OF SNO

    A NUMBER,

    B THE NUMBER.

    NUMBER OF THE SUM

    );

    CREATE AN ARRAY OF RESULT

    (

    NUMBER OF SNO

    NUMBER OF THE SUM

    )

    my doubt is:

    (1) I want to insert a table TAB, my question is how to insert a column to the SUM using the column A AND B... Here im adding two values of the column and store result in the AMOUNT column.

    SNO   A  SUM           

    1 100 150 250

    2 300 100 400

    I want to like this, it is possible with single insert query?


    (2) at the time of the insertion TAB of values that SNO, and the values of table TAB $ insert in the table of RESULTS... is it possible these two inserts at the same time?

    in fact, im using another this table.fro TAB and easy to understand I write like that, please solve this problem

    First, you post in the wrong forum as this one is only for Oracle's SQL developer tool. So you might ask your question in the general forum of SQL.

    Second, you might solve your problems with bind variable:

    Insert tab

    (sno, a, b, sum)

    values

    (: SNO,: A: B: A + B :))

    You should not use sum as column name because it is a reserved word.

    More you cannot insert into two different tables with a single SQL, but you can use PL/SQL to do this:

    Start

    insert into tab values (: SNO,: A: B: A + B :);)

    insert into result values (: SNO,: A + B :);)

    end;

    If you meet sno from a sequence, you could do something like this:

    Start

    insert into values tab (seq_sno.nextval,:,: B,: A +: B) return sno in: SNO.

    insert into result values (: SNO,: A + B :);)

    end;

    Hope that helps,

    dhalek

  • I can't open a picture jpg with my PS. I have already created another profile to my Mac, reinstalled Ps and one I updated the latest version of the operating system. Still does not open JPG. I want to know what to do next.

    I can't open a picture jpg with my PS. I have already created another profile to my Mac, reinstalled Ps and one I updated the latest version of the operating system. Still does not open JPG. I want to know what to do next.

    Then, you install Camera raw version 9.4 from this link: Camera Raw of Adobe Photoshop CC and CS6 Installer

  • I also have a .csv file with the name of a jpeg file in a column and a text description of each jpeg format in a second column. Is it possible to automatically insert a jpeg (picture) and its corresponding text, each pair on one page, in an Indesign docum

    I also have a .csv file with the name of a jpeg file in a column and a text description of each jpeg format in a second column. Is it possible to automatically insert a jpeg (picture) and its corresponding text, each pair on one page, in an Indesign document?

    Read about to merge data in the help files.

  • Is it possible to get the total value of column and set to another area

    Hello

    Is it possible to get the total value of a particular column, and assign this value to another discipline?

    How to do this?

    Thanks in advance,
    SAN

    Hi SAM,

    If your controller class throw this message it means that it works very well. Follow these steps, I hope this will solve your problem.

    1 check the following

    OAApplicationModule am = pageContext.getApplicationModule (webBean);
    OAViewObject ratvo = (OAViewObject) am.findViewObject("*CompetenceElementsVO*"); It should be the name of the instance instead of the name Physics vo vo.
    OAViewObject valuevo = (OAViewObject) am.findViewObject("*PerRatingLevelsVO*");

    2. extend this controller class that is associated with this region.

    I hope it will work now.

    Haroon.

  • How to copy columns from one table to another

    Hai All


    How to copy the contents of the array to another

    For example, first name of the table is T1 and I have 10 columns and data are here and I need to create a table T2

    But I don't need the header, but not the values of all the 10 columns of T1 to T2, but not values


    Thanks and greetings

    Srikkanth.M

    Why not?

    create table test1
    as
       select * from emp
       where 1 = 2;
    

    Kind regards.

    LOULOU.

  • Difference between an XMLType table and one table with an XMLType column?

    Hi all

    Still trying to get my mind on all that XML stuff.

    Can someone explain briefly the difference between:
    create table this_is_xmltype_tab of xmltype;
    and
    create table this_is_tab_w_xmltpe_col(id number, document xmltype);
    What are the advantages and disadvantages of each solution? How are they really different?

    Thank you

    -Mark

    Sorry Mark, as far as I know it is not a real difference despite the fact that you can use the table with the column (ID), probably more effective for document-focused while driving the query via the ID column and anything else I can think off automatically about XMLType contra XMLType table columns is that (as far as I KNOW) you can not use a column of XMLType to shred the data into it via WebDAV o FTP. But then again I never really tried to do an XMLType column-based. Alternatives, for example, a binary XML column begins with a column of $ sys_nc_oid which is indexed, so in principle you shouldn't need an ID (number) column that has an index (a read also on http://www.liberidu.com/blog/?p=494). If there has been non-null that you could use this index for document oriented applications.

  • Tabular: how dynamically toggle columns and rows

    Hello

    I am very new to ApEx sorry if this has been addressed before, but I can't find a solution in forums or with Google, so here I am.

    I have an table based on a view, with two elements as the primary key and instead - of trigger for update (only the updates made, not of insertions/deletions) and the form works fine (I can update and refresh, etc.) The form was created with the wizard, not manually.

    My problem is, I need to turn off (disable - not hide) of columns in the report to prevent changes according to the value of one of its own columns - for example, a value of + 'q' + in the column period is going to turn some columns, while value of + 'h' + will toggle other columns. (The 'q' / 'h' value is the same for all the lines in the form.)

    Similarly, I also need to toggle all lines according to the value of the column one another .

    To sum up, displaying the form of tables and according to the value of a column, I need to turn some of the columns. Thenfor each line that I sail and, according to the value of another of the column, I need to enable/disable one or more items on this line.

    Any detailed help on how to proceed would be greatly appreciated (and if you need more information please ask.)

    It was very easily in forms with the triggers when-new-record and the elements of parameters as enabled. I am really so confused as to how to do this with ApEx - not to mention that I am helpless with JavaScript... Given that the page works well with the wizard-generated form, I want to keep it this way, but I'm ready to learn new tricks if the solution is building manually (as explained here: http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html) or do it with a dynamic query (as explained here: http://www.oracle.com/technology/products/database/application_express/howtos/dynamic_report.html) although I'm not sure to understand things , explained here (and if she needs clean MRU treat...?)

    Thanks in advance,

    Ludovic

    You are the very welcome. I had a lot of help at the beginning of this forum so I try my best to give back. :)

    Good luck for the demo!

  • Compare two columns and get the percentage of cells that match

    Hello

    I'm looking to take two columns of data from different tables in the same document, which should have a high enough percentage of boxes and have another cell tabulate the corresponding percentage. I can the of seem to figure out how to do this, but it seems really possible.

    Any help is greatly appreciated.

    Thank you!

    C1 = A1 = B1

    It's shorthand dethrone select cell C1 and type (or copy and paste it here) the formula:

    = A1 = B1

    Select cell C1, copy

    Select the column C, paste

    Select cell E2, and then type 'TRUE '.

    Select cell E3 and then type "FALSE".

    F2 = COUNTIF ($C, E2)

    F3 = COUNTIF ($C, E3)

    G2 = F2÷SUM(F$2:F$3)

    G3 = F3÷SUM(F$2:F$3)

  • Insert columns and research implications need to change formulas

    I have two tables.   The first table with data has 7 columns.  The second table had formulas that had Vloopup choose a cell say, column 6 table 1.  I inserted new t in the middle of the table 1 columns, but the formulas in two table reflect the original column.  I expect that the formulas would have been updated to reflect the new position of the data in the column.  So if the research had received data from Col 6 it would now 8 Col.  That's how I remember it in Excel, is there something that I have not configured correctly or that is a feature.   Thanks in advance you all fine from smart people.

    Hello Gene,

    A glance at the current formula could offer some advice for a possible change.

    One that comes to mind is to use the MATCH to determine the position of the column to the desired source. This would require an exact match between the name of the target column and the name of the source column.

    Kind regards

    Barry

  • Compare multiple columns and return a different value

    I have more access to excel and I'm running my previous workflow in numbers of duplication of issues.

    I have a worksheet when a sheet with all my power tools.  On the "Power Tools" sheet I have columns for the brand, Type, model, purchase date, etc...  An example of this would be: pass a "DEWALT", "Jackhammer" Col B, Col C "DCD995M2" and so on.

    I have a second sheet in the same document which is my front end if you want.  I wanted to have selections for this dynamic drop-down list but it seems it is not possible without scripts, but is not the immediate question yet I'm the mention the case where someone knows a good fix.  The second sheet "Sorting Test", I created manually drop-down boxes, one in column A of the brand and the other in column B for Type.  I'll choose the brand and type and I want numbers autofill the rest of this line based on these two selections.

    Example:

    In the 'Sort Test' sheet I select DEWALT in column A and I select the drill in column B and I want DCD995M2 is displayed in column C and the purchase date in column D and so on.

    Excel in it would be a game table or something similar.  So far every site and search google only gave a lot of people who try to do VLOOKUP or correspond to errors, but I've really met anyone corresponding to two distinct cells from two separate columns and return data from this same line a match was found on.

    I must also mention I'm really trying to avoid adding a hidden line that combines some of these but I know it's the most noticeable work around.

    Basically, I want to match two selections separated against two separate columns, and when it finds the match, I want it returns a different value of this corresponding line how I got everything just copy this formula on adjacent cells and simply adjust to the column in the same row matched.

    I know that I shouldn't do this on separate sheets, but it's just a choice that I made a point of design.

    Any help would be appreciated, because I'm trying to really get the most out of the numbers, especially with how it syncs between desktop and mobile and I have more access to Excel.

    You can it as what you do and why?  This will help us understand what drives the design.  Leave out how to solve the problem,

    also post screenshots can be very useful

  • When you use the media player, it is possible to take a song that's already torn in our library and announced another song or part of the same song at the end? kinda like a mix.

    When you use the media player, it is possible to take a song that's already torn in our library and announced another song or part of the same song at the end? kinda like a mix.

    Windows Media Player is not a Publisher.

    You can use Windows Movie Maker to split
    and combine audio files, but it works better
    If they are in the. WMA format.

    Also the free Audacity software may be worth a try:

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Audacity

    http://Audacity.sourceforge.NET/

    How to split a long recording into multiple files or CD tracks?
    http://Audacity.sourceforge.NET/Help/FAQ?s=files&i=split

    How to combine two files into one longer file?
    http://Audacity.sourceforge.NET/Help/FAQ?s=editing&i=join

    How to mix songs with Audacity
    http://www.ehow.com/how_5061510_mix-songs-audacity.html

  • What anti-virus/anti-malware programs in conflict with one another?

    many have said that too many anti-virus/anti-malware programs installed can damage these collide with one another, causing the programs may not run correctly and sometimes cause the computer hang very badly. So what programs shock/does not shock with another?

    (eg. malwarebytes and norton are compatible)

    It seems that your registry cleaner question has not been answered.

    The so-called "registry cleaners" can aggravate a situation and take measures, we are manually updated on many times.
    It is better not to rely on these programs, if you don't know what is happening with the proposed fix and the registry.
    Otherwise, a change in the registry can make a system that no longer starts due to an error.

    Here are a few good discussions:
    http://aumha.NET/viewtopic.php?t=28099
    http://www.whatthetech.com/2007/11/25/do-i-need-a-registry-cleaner/
    http://billpstudios.blogspot.com/2007/04/do-i-need-registry-cleaner.html

  • I'm looking for a manual form PDF for Windows Vista and one for Windows 7 ULT.

    Hi Tech, representatives and mods,

    I'm looking for a file PDF instruction manual for Windows Vista and one for Windows 7 ULT.

    I am trying to solve some problems on the PC of my mother for him and she not Vista operating instructions supplied with the installation of the plant on his Dell Inspiron 531.

    Also, because of irreparable corrupt software problems, Microsoft technicians have ordered me a Windows 7 installation disc that came in the mail, but there is no manual and I would like to know the procedures of installation and the new UI so I install it.

    Anyone know where I can download manuals of instructions PDF for Vista or Windows 7? ... can't find on the Microsoft Web site, but maybe I can't find them.

    Thanks for any help,

    NuMetro


    Hi Aziz,.

    I appreciate of course send you these links to the instructions for the installation of 7 and Vista... I will use them when trying to fix computer Vista my mother sick.

    But it turns out there are some out there in free download e-book/PDF manuals, and one for Windows 7 is quite comprehensive, edited by a guy named Rich Robinson on http://mintywhite.com/books/ ... See the response, copied below, I got "JacK MVP" when he replied to my post on the Windows 7 forum...

    _________________________________________________________________
    Jack MVP MVP Moderator
     

    Hello

    Look at this page, http://mintywhite.com/books/

    You need to register, but it's good and free courtesy of Microsoft MVP.

    _________________________________________________________________

    It's a little complicated to register on this site... I click on a link to a book, then on the page following, I get my email address, then I get an email confirming my registration, by which I can get an e-mail newsletter every day with a new password to download e-books. If the newsletter has already been sent to this day there, I click a 2nd link in this email in order to receive another email with the password... then by clicking a link in the 2nd e-mail, I get to the page where I did enter the password... so I can download e-books... as easy as 1-2-3... 4-5-6-7-8-9-10-11...

    TIP: the password appears to be the same thing every day, or was yesterday and today it's 'mintywhiteBooks '... How sneaky.

    For a minute there, I thought that this site was a kind of lure because on the page "to subscribe/instructions", where I get my e-mail, there are 2 jpeg images that resemble password fields and links, but they are not... I'm not sure of what those who are for.
    This mintywhite.com seems to be quite the site for amateurs and Windows technicians.
    Thank you
    Enjoy,
    NuMetro

Maybe you are looking for

  • Toshiba NB520 - very low WiFi signal strength

    Hello My new netbook Toshiba NB502 has a signal strength wireless very low compared to the other two netbooks used in my house.I tried to play with the Device Manager but can't see any obvious way to improve the signal. Any advice?

  • Configuring the Ports of premium?

    Hello I have a camera (9636) sbRio with analog inputs which I use to acquire data. In my Labview project, I have listed the chassis and FPGA, and connectors. If I click on, say, AI0, I can set the sensitivity of tension (1, 5 or 10 volts) and is it a

  • get the index of a table display

    Hello! I have a question. Is it possible to get the index of a current table in the front panel? I have 2 tables which need to scrool simultaneously to the user, so my idea was to read the index of a table and 'write' on the second. Can someone give

  • Mute button does not turn on

    I use a HP envy laptop 4 about three days.  After update everything from windows update and HP, the mute button not more light upward on the keyboard when I cut the sound.  I see she is silent in the taskbar in the corner, but it usually shines orang

  • Windows Live Mail - the connection to the server has failed.

    I use Windows Live Mail to read my email.  Today it stopped working with the following error: Can't send or receive messages for the Yahoo! Mail account. The connection to the server has failed. Server: 'pop.sbcglobal.yahoo.com '.Windows Live Mail er