print the currency compared with the help of sql - sum sum

I want to display summary amount for each ID with the motto inscribed on the amount as

1 US $60
2 GBP 30


create table t1 (id number, currency varchar2 (3), the number of quantity);
insert into t1 values (1, 'USD', 10);
insert into t1 values (1, 'USD', 20);
insert into t1 values (1, 'USD', 30);
insert into t1 values (2, "GBP", 5);
insert into t1 values (2, "GBP", 10);
insert into t1 values (2, "GBP", 15);

Thanks in advance

Hello

Can be like that

SELECT id, currency || ' ' || SUM (amount)
      FROM ta1
    GROUP BY id, currency;

see you soon

VT

Tags: Database

Similar Questions

  • How to print the transaction validation sql?

    All,

    With the help of Studio Edition Version 11.1.1.3.0.

    I got a violation of primary key constraint that I can't quite understand. I can insert fine lines and everything looks very much like the page refreshes, but when I sign, I get the error. I would like to know what is committed to the database. I understand the problems normal display when your association is not composite: http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcadveo.htm#CEGJAFCF, but in my case, this one is.

    How to print the SQL that is generated when getDBtransaction.commit () is called?

    That should tell me why I get a command validation error (if that is what it is).

    Thank you
    Will be

    Add - Djbo.debugoutput = console for the properties of the project

  • Print the help of style sheet?

    Hi all

    I have a site that needs to present, but I have a problem with my print style sheet.

    I checked his writing on forums, etc., and by making print media style type just fab. But when in a live browser and I saw print, nothing shows on the screen (or when I print)

    Can someone tell me please in the right direction? I have checked and double-checked everything. I put on my forum of course and emailed every tutor I can find, but did not have all the answers.

    Forum Adobe, please, help me!

    Nina

    completely the form of this code

    print_style_sheet. CSS

    #container {}

    background-image: none;

    Width: 7 inches;

    display: none;

    background-color: #FFF;

    Color: #000;

    }

  • With the help of SQL, need to display the previous year, current year and the year next to single variable

    Hi all

    We have an obligation to state the previous year, current year and values of the year next as a LOV in the ADF page.

    This is the query that retrieves the previous year, current year and next year. But the result of this query displays values in 3 columns:

    Select (Extract(year from sysdate)-1), extract (year sysdate), (extract (year sysdate) + 1) twice;

    Output:

    2012 2013 2014


    But I want to display them in a single with 3 rows as column:

    2012

    2013

    2014


    Please your ideas.

    or in the same way

    SELECT EXTRACT (YEAR FROM ADD_MONTHS (SYSDATE, 12 *(LEVEL-2)))

    OF the double

    connect by level<>

  • SEQUENCING WITH THE HELP OF SQL

    Hello

    I have a requirement such as if my data is as follows

    name identity
    1 John
    2 John
    3 jane
    4 jimmy
    5 jimmy
    Jack 6

    I need a sequence that looks like

    Name seq ID
    1 John 1
    2 John 1
    3 jane 2
    4 3 Jimmy
    5 jimmy 3
    6 Jack 4

    and so on

    So, I have a suspicion we can use analytics, but cannot set up a query to do this.

    Sorry, it of a little naïve but would appreciate a hint...

    Thank you
    Birdy

    Hi, Birdy,

    Birdy says:
    Hello

    I have a requirement such as if my data is as follows

    name identity
    1 John
    2 John
    3 jane
    4 jimmy
    5 jimmy
    Jack 6

    I need a sequence that looks like

    Name seq ID
    1 John 1
    2 John 1
    3 jane 2
    4 3 Jimmy
    5 jimmy 3
    6 Jack 4

    and so on

    So, I have a suspicion we can use analytics, but cannot set up a query to do this.

    Your right; analytical functions can do that. DENSE_RANK assign a number without gaps, duplicate output when the input is duplicated.
    Do you care which name gets seq = 1 and who gets seq = 2? If this isn't the case, you can sort the names alphabetically:

    SELECT     id
    ,     name
    ,     DENSE_RANK () OVER (ORDER BY  name)     AS seq
    FROM     table_x
    ;
    

    In the output you posted, it appears you want what they classified by the id low associated with each name ('Jean' = 1, 'jane' = 3 and so on). You can get the id low with the analytical MIN function:

    WITH     got_min_id     AS
    (
         SELECT     id
         ,     name
         ,     MIN (id) OVER (PARTITION BY name)     AS min_id
         FROM     table_x
    )
    SELECT     id
    ,     name
    ,     DENSE_RANK () OVER (ORDER BY  min_id)     AS seq
    FROM     table_x
    ;
    

    Analytical functions cannot be nested. In other words, you can not say

    ... OVER (ORDER BY MIN (id) OVER ...)
    

    That's why I used the got_min_id of the subquery.

  • With the help of sql filter expression

    Hi Experts,

    I have a question using "sql expression" in the filters in the responses. Let's say I have a date filter and I wish that the value for this date as max (tablename.colname). Please tell me the syntax for this passage.

    Another issue is that I have a date guest data are updated every week we'll tell the data refreshed like this * 01/08/11, 08/08/11 and 15/08/11 *. Now, if I select the 08/08/11 it will display the data
    populated on * 08/08/11 * which is ok, but if I select * 09/08/11 to 14/08/11 * it only shows * 08/08/11 * data. Similarly, if the option * 16/08/11 or 16/09/11 * it should show the latest up-to-date data which is * 15/08/11 *.

    Thanks in advance.
    Chak

    OK, if that State is limited as of the last update when your selects a date in guest that is beyond / above the last refresh date.

    This can be a way to do as below:

    – Enter the last updated date in a variable repository. If this variable will always hold a value for the last date discount.
    -In guests, capture the date selected by the user in a variable of presentation and to apply the Sub statement in SQL advanced report.

    DateColumn = case when Timestamp ' @{RBAP} {2011-01-01 00:00:00}'<= valueof("lastrefdate")="" then="" timestamp="" '@{pvar}{2011-01-01="" 00:00:00}'="" else="" valueof("lastrefdate")="">

    RBAP following your presentation and lastRefDate var is your variable rep containing the last refresh date. What would this statement, if the user selects a date that is less than equal to the last refresh date, then report is filtered from this date. Otherwise, the report will be filtered by the value of the date of the last update.

    Thank you

  • The help of SQL DBMS Flashback AS THE SNA

    I would like to use the DBMS Flashback feature in some SQL code to look at the data in a table based on the SNA.
    That is to say.
    Select ename
    of the emp to the SNA 15387125
    where empno = 442

    I know that the length of time, you can use flashback to the SNA for controllable is (thought of by default is 900 seconds), but I assure you. I have not changed the DB params on my system, and the above statement works longer than 900 seconds.

    If I try to go back to something that happened a few days ago that I get:
    ORA-01555: snapshot too old: rollback segment number 9 with the name ' _SYSSMU9_3490907396$ ' too small

    Can anyone confirm what I watch / set up to the time OF THE SNA.

    Thank you

    Available at Flashback depends on how the DB_FLASHBACK_RETENTION_TARGET parameter. By default (in 10G) is 1440 minutes (1 day). [url http://docs.oracle.com/cd/B19306_01/server.102/b14237/initparams050.htm#REFRN10233] To learn more.

    Unless you have a particularly parsimonious DBA you must have considerably longer than a quarter of an hour. But not, of course, "a few days". Although this setting specifies an upper limit, and the window of real flashback could be lower if there has been a lot of activity that has eaten up in the region of flashback.

    Cheers, APC

  • the help of SQL queries

    my existing query is


    Select c.ADVICE_NOTE_ID, C.TAX_AUTH_ID
    of OUTBOUND_EXTERNAL_SETTLE_TBL b, outbound_payment_tbl c
    where B.OUTBOUND_PYMNT_ID = C.OUTBOUND_PYMNT_ID

    now I need to select from the advice_note_id of sample_tbl where the combination of sample_tbl.advice_note and sample_tbl. TAX_AUTH_ID does not match the one selected by top of the query.

    Hello

    This looks like a job for NOT IN:

    SELECT     advice_note_id
    FROM     sample_tbl
    WHERE     (advice_note, tax_auth_id)  NOT IN
         (
              select      c.ADVICE_NOTE_ID
              ,      C.TAX_AUTH_ID
              from      OUTBOUND_EXTERNAL_SETTLE_TBL      b
              ,      outbound_payment_tbl           c
              where      B.OUTBOUND_PYMNT_ID      = C.OUTBOUND_PYMNT_ID
         )
    ;
    

    This requires that thatadvice_note_id and tax_auth_id cannot be NULL in outbound_payment_tbl.

  • My LaserJetPro 400 printer is not recognized on the USB ports. With the help of El Capitan OSx

    Since I installed OSx El Capitan, I had intermittent problems with the USB ports to connect to my HP LaserJet printer. I first thought that the older printer was not compatible with the new OSx software, so I've just upgraded to a new HP LaserJet Pro 400 M451dw. same results and the computer is not even connect to the printer. The number of post detailing a similar problem, I would hope that apple now had a fix for this problem...

    It gets very frustrating to say the least.

    Help

    T Cooke

    HI T Cooke,

    Welcome to Apple Support communities.

    The article below provides a lot of information and troubleshooting tips that may help you solve problems with your MacBook Pro grateful and print to your printers.

    OS X El Capitan: print troubleshooting

    Ciao.

  • When I try to print a document with an ink cartridge that is only a few days, nothing appears on the page, despite the fact that the printer is a sound impression! Help!

    My printer model is brother, 5 in 1, and before that, I didn't the drama with her. After replacing the cartridge in the course of the week, it worked 100% with happiness, seems to have run out of ink until halfway through a page and I can't get black print at all now. I fixed up a spare cartridge black, as I thought it must have been defective, but that one is not printing ANYTHING.

    The printer sounds like it is printing, and the sound is normal.

    I hope someone can help me!

    Hi FionaBond,

    ·         What is the complete model of the printer number?

    I suggest you to take a look at the donated items and check if they help.

    Print the problem - troubleshooting

    Solve printer problems

    Hope the helps of information. Please post back and we do know.

  • My HP Photosmart 7660 printer does not work with Win 7 Ultimate. Need help, where can I get the right driver?

    My HP Photosmart 7660 printer does not work with Win 7 Ultimate. Need help, where can I get the right driver?

    Visit the HP website and look.

  • I have a new computer with windows 7 Home premium. just installed my Presentation adobe acrobat 6.0 standard, the installation as a warning code 20225 appeared? I also noticed that my residence PDF printer is missing? You can help me solve the problem. Br

    I have a new computer with windows 7 Home premium. just installed my Presentation adobe acrobat 6.0 standard, the installation as a warning code 20225 appeared? I also noticed that my residence PDF printer is missing? You can help me solve the problem. Bren

    Versions of Windows beyond Windows XP are not entirely compatible with Acrobat 6. The first version of Acrobat that is supported by Windows 7 is Acrobat 8.1 (is no longer licensed by Adobe). The latest version of Acrobat: Acrobat Columbia, six versions more recent than Acrobat 6. You need to upgrade to get all the features of Acrobat.

    -Dov

  • With the help of Windown 10, not all pdf documents launch Adobe Reader DC.  As a result, I have not all normally available printing options.  How can I get Reader to open the default player.  I need to clear, step by step direcitons, please.  Thank you

    With the help of Windows 10, not all pdf documents launch Adobe Reader DC.  As a result, I have not all normally available printing options.  How can I get Reader to open the default player.  I need to clear, step-by-step instructions, please.  Thank you

    Hello

    Please visit the following link to set the reader as default PDF reader.

    Restoration of Adobe Acrobat Reader in the default PDF Viewer

    Concerning

    Sukrit diallo

  • Slow printing when printing on 6x8inch paper. With the help of my new printer HP Deskjet 1514.

    When I print on a page size 6 x 8 inch using black ink, the time taken to print the page is 1 Minute 40 seconds. It is indeed very slow!

    When I print the same exact pages on A4, the time taken to print the page is 15 seconds. This is acceptable!

    I use Windows 7 and Office 2007.

    In addition, no error message is displayed.

    Help, please!

    What are the parameters of type of paper? The speed to 6 x 8 paper resembles results would happen if printing on photo paper.

    If you are printing on plain paper make sure plain paper is selected in the driver.

  • My Photosmart Premium stopped printing yellow or green on the photos! With the help of HP ink cartridges

    My Photosmart Premium All in One C410a is now printing photos that go far too not blue - no yellows or Greens.  Use the HP cartridges, and all are at least half full.  Help! A perfectly printed in the past.

    I am trying to print from iPhoto, which Ive done hundreds of times and am on premium glossy inkjet photo paper (a new package, incidentally).  I have not changed the settings recently when printing.  Flash Info - just ran a report of print quality and also checked the settings.  Then I printed the same image that I had tried before, and it seems very well!  Have no idea why, but it looks like Im back in business! Wahoo.  Thanks a lot for me having to check so many places.  Must have done something right just now!

Maybe you are looking for