Can anybody help me to buil this query

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE     10.2.0.1.0     Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
============================
table1
======
lvl1 lvl2 lvl3 lvl4 value
============================
a b c c1 100
a b c c2 200
a e d 30
table2
=========
lvl parenttochild
==================
a 1
b 2
e 2
c 3
d 3
c1 4
c2 4
can i make it from the above table
lvl parenttochild value
=========================
a 1 330
b 2 300
e 2 30
c 3 300
d 3 30
c1 4 100
c2 4 200

user5813325 wrote:
1st two column coming from table 2 and next column-sum of all(a) 330,sum(b)-300 like that way...Not clear with this explanation.
But still,
--Sample table
with table1
as
select 'a' lvl1, 'b' lvl2, 'c' lvl3, 'c1' lvl4, 100 value from dual
union all
select 'a', 'b', 'c', 'c2', 200 from dual
union all
select 'a', 'e', 'd', '', 30 from dual
), table2
as
select 'a' lvl, 1 parenttochild from dual
union all
select 'b', 2 from dual
union all
select 'e', 2 from dual
union all
select 'c', 3 from dual
union all
select 'd', 3 from dual
union all
select 'c1', 4 from dual
union all
select 'c2', 4 from dual
-- End of sample table
-- Main Select
select t2.lvl, t1.value
  from (
          select decode(no, 1, lvl1, 2, lvl2, 3, lvl3, 4, lvl4) lvl, sum(value) value
            from table1,
                 (select level no from dual connect by level <= 4) -- Number of columns 4
           where decode(no, 1, lvl1, 2, lvl2, 3, lvl3, 4, lvl4) is not null
           group
              by decode(no, 1, lvl1, 2, lvl2, 3, lvl3, 4, lvl4)
       ) t1
  left
  join table2 t2     
    on t1.lvl = t2.lvl
--End of main select
LVL VALUE                 
a   330                   
b   300                   
e   30                    
c   300                   
d   30                    
c1  100                   
c2  200                   

Similar Messages

  • I did the iTunes update yesterday and now I am getting this message when I try to open iTunes - "This copy of iTunes is corrupted or is not installed correctly. Please re-install iTunes. (-42037) Can anybody help me out resolving this?

    I did the iTunes update yesterday and now I am getting this message when I try to open iTunes - “This copy of iTunes is corrupted or is not installed correctly. Please re-install iTunes. (-42037) Can anybody help me out resolving this?

    Download iTunes using the tab at the top of this page, re-install.  Back up your computer first.

  • HT1338 I have a macbook Pro i7 mid november 2010. I am wondering if i can exchange my notebook with the latest one. Can anyone help me out with this query please.

    I have a macbook Pro i7 mid november 2010. I am wondering if i can exchange my notebook with the latest one. Can anyone help me out with this query please.

    You can sell your existing computer using eBay, Craigslist or the venue of your choice. You could then use the proceeds to purchase a new computer.

  • Can anybody help me to troubleshoot this code

    According to this code i must get the same number as o/p. But shift and add seems not functioning well.Can anybody help me to troubleshoot

    Hello Pushpa,
    Thank you for contacting National Instruments.
    Which code are you specifying
    Just make your problem clearly and elaborated
    you can send me your code & If you might want to contact the developer of your application, contact - [email protected]
    Have a great day.
    Regards~
    Mathews
    [email protected]

  • Please can you help me in Tuning this query..?

    Hi ,
    Please can you help me in re-structuring this query? .Details are given below.
    I have 2 tables as shown below and data is like this.
    Position
    COD IND
    AAA N
    BBB N
    CCC N
    DDD Y
    Distance
    orig dest
    AAA BBB
    BBB CCC
    AAA CCC
    I need to create the records like this
    start end
    DDD AAA
    DDD BBB
    DDD CCC
    The query which i am using now for this is
    select p.code AS start,
    P1.CODE AS end
    from position p, position p1
    where
    P.CODE != P1.CODE
    AND (P.ind = 'Y' or P1.IND = 'Y')
    AND not exists
    (select 1
    from distance d
    where (d.orig = p.code or d.dest = p.code)
    and (d.orig = p1.code or d.dest = p1.code))
    table is having above a crore record. so its taking a lot of time.
    Please someone please help in tuning this query?
    Thanks and regards,
    Shabir

    Looks like you want this
    select a.strt, b.ends from
    (select p.code strt from position p where p.ind='Y') a,
    (select p.code ends from position p where p.ind='N') b
    where not exists (select 1 from distance d where d.orig=a.strt or d.dest=a.strt);
    DDD     AAA
    DDD     BBB
    DDD     CCCYour query result is:
    AAA     DDD
    BBB     DDD
    CCC     DDD
    DDD     AAA
    DDD     BBB
    DDD     CCCYou should be more descriptive about what kind of result you want, so that people can get more interested in helping you.

  • My Ipod doesn't sync songs anymore, can anybody help me out with this?

    Hi all. Yesterday i did a Recovery on my computer and that wiped everything clean off of my computer, including the Itune program that i downloaded. And now, every since i downloaded Itunes again, it won't sync songs into my Ipod anymore. When i would download a few songs into Itunes, I would press on the sync button a message comes up saying that my ipod is synced with another Itunes library and can only be synced with one at a time. This won't let me transfer the songs onto my ipod. When i tryed to sync my songs again another message pops up saying to 'erase and sync'. Meaning that in order for me to sync the new songs onto my ipod, then they are gonna erase all of my existing songs that is currently on my ipod already! I don't wanna do that. I thought about restoring my ipod but i'm afraid that that would erase all of my songs off of my ipod as well.  What do i do? Help would really be appreciated. Thank you. 

    Your iPod is designed to sync with only one iTunes library at a time.  It will recognize the iTunes library on the restored/rolled back PC as a new library.  If you sync the iPod with this new/different library, all content will be erased from the iPod and replaced with what is in the new library.  So what you will want to do is copy everything from the iPod to your new iTunes library on your PC first.
    See this older post from another forum member Zevoneer covering the different methods and software available to assist you with the task of copying content from your iPod back to your PC and into iTunes.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • Can anyone help me on building this Query. I am having difficulty.

    Provide a query that shows all items that where created by a person. A partial name for the person may be used. For example, show me all works by “Morrison”. I should see CD’s by Van Morrison and a poetry book by Jim Morrison. WHERE NAME =”MORRISON”

    First, technical questions should be addressed to a technical forum. Products | Database | SQL & PL/SQL would be appropriate for this question.
    Second, you probably want to use the LIKE function here along with a wildcard
    WHERE UPPER(NAME) LIKE '%MORRISON'will identify all rows where the name ends with 'Morrison'. If you want to allow 'Morrison' to appear anywhere in the name (i.e. the company 'Morrison Knudsen'), you would have the wildcard on both sides, i.e.
    WHERE UPPER(NAME) LIKE '%MORRISON%'Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Can anybody help me to understand this RMI registry service code?

    RMI is so difficult to me. please let me know following code what it means.
    If this class is instantiated with 50000 port number,
    Does RMI Registry Service get started with 50000 port number in place of rmiregistry commands?
    And I don't have to execute rmiregistry command?
    thanks in advance.
    import java.rmi.AccessException;
    import java.rmi.AlreadyBoundException;
    import java.rmi.NotBoundException;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.rmi.registry.Registry;
    import java.rmi.server.ObjID;
    import java.rmi.server.RemoteServer;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import sun.rmi.server.UnicastServerRef;
    import sun.rmi.transport.LiveRef;
    * Registry implementation.
    * @version 1.0
    public class RegistryImpl extends RemoteServer implements Registry {
         private static final long serialVersionUID = -7162736590129110751;
         private Hashtable bindings;
        private static ObjID id = new ObjID(0);
         * @param i port number
         * @throws RemoteException
        public RegistryImpl(int i) throws RemoteException {
            bindings = new Hashtable(101);
            LiveRef liveref = new LiveRef(id, i);
            setup(new UnicastServerRef(liveref));
        private void setup(UnicastServerRef unicastserverref) throws RemoteException {
            super.ref = unicastserverref;
            unicastserverref.exportObject(this, null, true);
         * Lookup a remote object.
         * @param name Name of the remote object.
         * @return Remote object of the specified name.
        public Remote lookup(String name) throws RemoteException, NotBoundException {
    //        Logger.debug("NamingService", "lookup: " + name);
            Remote obj;
            synchronized(bindings) {
                obj = (Remote)bindings.get(name);
                if(obj == null)
                    throw new NotBoundException(name);
            return obj;
         * Binds the specified name to a remote object.
         * @param name A URL-formatted name for the remote object.
         * @param obj A reference for the remote object (usually a stub).
        public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException {
    //        Logger.debug("NamingService", "bind: " + name);
            checkAccess("Registry.bind");
            synchronized(bindings) {
                if(bindings.containsKey(name))
                    throw new AlreadyBoundException(name);
                bindings.put(name, obj);
         * Destroys the binding for the specified name that is associated with a remote object.
         * @param name A URL-formatted name for the remote object.
        public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
    //        Logger.debug("NamingService", "unbind: " + name);
            checkAccess("Registry.unbind");
            synchronized(bindings) {
                if(!bindings.containsKey(name))
                    throw new NotBoundException(name);
                bindings.remove(name);
         * Rebinds the specified name to a new remote object. Any existing binding
         * for the name is replaced.
         * @param name A URL-formatted name for the remote object.
         * @param obj A reference for the remote object (usually a stub).
        public void rebind(String name, Remote obj) throws RemoteException, AccessException {
    //        Logger.debug("NamingService", "rebind: " + name);
            checkAccess("Registry.rebind");
            bindings.put(name, obj);
         * Returns an array of the names bound in the registry.
         * @return An array of the names bound in the registry.
        public String[] list() throws RemoteException {
            String[] names;
            synchronized(bindings) {
                int i = bindings.size();
                names = new String;
    Enumeration e = bindings.keys();
    while(--i >= 0)
    names[i] = (String)e.nextElement();
    return names;
    * TO-DO
    public static void checkAccess(String s) throws AccessException {
    // check if s is in the list of agents.
    if(true)
    else
    throw new AccessException("");
    public static ObjID getID() {
    return id;

    You don't have any need to understand this code. The complication is due to the registry needing a fixed objectID.
    You just need to know the methods of java.rmi.registry.LocateRegistry class. This allows you to start an RMI Registry inside your JVM and give it any TCP port number you like.

  • HT201210 i bought a iphone 3g from market yesterday and the phone is showing a usb an also itunes logo on the screen, the ive tryed restore and update, but once this has finished it gives me erra code (1015) can anybody help me plz

    i bought a iphone 3g from market yesterday and the phone is showing a usb an also itunes logo on the screen, the ive tryed restore and update, but once this has finished it gives me erra code (1015) can anybody help me plz

    Error 1015: This error is typically caused by attempts to downgrade the iPhone, iPad, or iPod touch's software. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version is not supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you are now trying to restore to an authorized, default state.
    http://support.apple.com/kb/TS3694#error1015.

  • Itunes 64 bit wont install on my Dell XPS due to Windows Installer problems. Can somebody help me out with this?

    I have Windows 7 home premium, running on a Dell XPS 15, with 64 bit OS, and when i went to install itunes for my new phone, it would almost install, but then say that it couldn't install due to issues with windows Installer. has anybody had this happen to them? can anybody help me out with this?

    Many thanks.
    "There is a problem with this Windows Installer Package. A program required for this install to complete could not be run. Contact your support personnel or package vendor".
    Perhaps let's first try updating your Apple Software Update.
    Launch Apple Software Update ("Start > All Programs > Apple Software Update"). Does it launch and offer you a newer version of Apple Software Update? If so, choose to install just that update to Apple Software Update. (Deselect any other software offered at the same time.)
    If the ASU update goes through okay, try another iTunes install. Does it go through without the errors this time?

  • I urgently need a contact email for the sales team can anybody help me with this

    I urgently need a contact email for the sales team regarding an outstanding query, can anybody help me with this please? Thanks in advance.

    Hello 
    Welcome to the EE Community! I'm afraid there isn't an e-mail you can contact the EE Mobile Sales team on, but here's how you can get in touch with them:
    If you're on Twitter, you can tweet them @EE, however If you'd prefer to talk to someone, you can dial:
    150 from your EE mobile phone
    If you're ringing from another phone, it's 01707 315000
    For handy text codes & more, check out this page: http://ee.co.uk/help/get-in-touch Cheers,
    Titanium
    Was my post helpful? Please take 2 seconds to hit the 'Kudos' button below

  • My ipad just won't let me enter my apple password on FaceTime or iMessage, it works fine on my iPhone, I have tried numerous things but nothing works, can anybody help please, will a bug fix sort this out when they finally make one

    My ipad just won't let me sign in with my apple password on FaceTime or iMessage since updating to ios7 it says check my network connection, even though my iPhone works fine with the same password, can anybody help please, I have tried numerous things but nothing  works.  Will I have to wait for a bug fix to sort this? I hear they are working on one a the minute, I hate ios7

    Try a Restart.
    Press and hold the Sleep/Wake button for a few seconds until the red "slide to power off" slider appears, and then slide the slider. Press and hold the Sleep/Wake button until the Apple logo appears.
    Resetting your settings
    You can also try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. You won't lose any data, but it takes time to enter all of the settings again.
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears. Apple recommends this only if you are unable to restart it.
    Or if this doesn't work and nobody else on the blog doesn't have a better idea you can contact Apple.
    Here is a link to their contacts with most of the information below.
    http://www.apple.com/contact/

  • I'm using iphoto9.1.3 but now it doesn't seem to work, whenever I try to open it, it just shows loading, but never loads. Can anybody help me with this ?

    I'm using iphoto9.1.3 but now it doesn't seem to work, whenever I try to open it, it just shows loading, but never loads. Can anybody help me with this ?    

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • Hi want to convert a number in crore, e.g. 10000000 to 1.00 Can anybody help on this?

    Hi All,
    I want to convert a number in crore format.
    My basic problem is, I am using a custome format:
    #,##0.00,,,%;
    Here main task is done by ,,,%.
    Each comma (,) is dividing a number by 1000. Thus three commas are dividing a number by 10^9 digits.
    But I need number in crore (i.e. 10^7), Thus we have used this percent sign (%).
    Here I can get required Value but appended percent (%) to it. I can temporary hide this using wrap text.
    But I need exact solution to convert a number in crore.
    Can anybody help me regarding the same.

    Hi Neha,
    You can use EPMScaleData function, in that give scaling factor as per your requirement.
    For more details you can go through following link
    How to use EPMScaleData in a fully dynamic report
    Regards,
    Shrikant

  • I am trying to instal the latest version of iTunes onto my MacBook Pro, but my computer has been "configuring" the installation since 5pm yesterday and now it is 10:30am. It has never done this before. Can anybody help me out?

    I am trying to instal the latest version of iTunes onto my MacBook Pro, but my computer has been "configuring" the installation since 5pm yesterday and now it is 10:30am. It has never done this before. Can anybody help me out?

    Many thanks b Noir
    This is a copy of ONEof the keys  in the registry I changed  as told by Apple support today. I also have changed others as instructed by GEAR  software support to manually delete GEAR drivers (that I had installed but couldn't delete some of the others  they mentioned from Windows system 32. Then some bright spark at work told me I need the Gear drivers so  I downloaded the software and installed again.
    Sorry, just this minute went to insert image  and it is giving me a message saying this sort of content  is not allowed?.
    The most recent key I altered is in: HKey _local _machine. System\class - 4D36E965-E325-11CEBFC1-08002BE10318. Upper Filter data: Upper filter NTIDrvr  SiRem GEARAspiWDN.
    The GEARsoftware info about manually deleting  GEAR drive is from:
    http://www.gearsoftware.com/wiki/index.php?title=DRIVERS:_Windows_-_Updating%2C_ removing%2C_64_bit_versions%2C_etc
    I hope you can help

Maybe you are looking for