Problem of sum and group with MSSQL


I'm a quiet complex query after users entry form. The result looks something like this (data simplified, useless and truncated fields)

cat_id | producttext
-------------------------------------
1002 | Parma ham
1013. Bordeaux
5006 | Parma ham
1005. Something
1002 | Another product of Kat 1002

As you can see the first and last record have the same cat_id.

What I want ultimately is to know the percentages of products in the same range (1001-2000, 2001-3000...)
and the percentage of products in the same chat (such as 1002)

I do this simply by a subquery on every Beach, see attached code (query1).
The problem is I don't need only the cat_id but is dependent on the language name.

I can get it with the query as (see query2) but, it used to function if the FROM is another query. It only works if I choose a real table.

All advice what to do different?

What I really want ultimately is a table like this:

2 1002 Fleisch
1 1005 Beilagen, pasta, Reis, Konserven
1 1013 great






This have I done.
I do the join in the 'base' didi - query.

Thank you

Tags: ColdFusion

Similar Questions

  • Scrolling group problem: not all the group with scrolling content?

    Helloooow peoplez script wise.

    I was biting my nails on this problem, the last two days and still have not found a solution. Go here:

    I tried to make a window (or Panel actually, because ultimately it must be run from the EI > window > scriptname.jsx), with a scroll bar, which can scroll content in a group beside him. I can get the scroll and all group, but is the problem, just now, that the elements of x in the group, the last get cut. Like this (it is supposed to be 500 buttons):

    Screen Shot 2015-10-13 at 21.40.05.png

    The only way that I was able to get the 'internal' group grow is by not using do not align properties and manually set the .size. I know that the content is here because the last element arises, when I move the last location of points [1] upwards until he reached the top of the group. I tried to refresh the page layout (layout.layout (true); layout.resize (()) to each call of the function onChanging() of the cursor, but without success. Read a lot of forum posts beautiful and discussion by @Marc Autret and other users of scriptUI/extendscript long has this far been without success.

    TL; DR: I'm doing a group with a lot of content that I can scroll with a scroll bar.

    Here is the code snippet, I hope fairly well commented:

    {
    //scroller test
    // uncomment the temp path (replace with some image file path) and the lines inside the populateGrid() function to reproduce my problem better
    // I'm ussing an image 512x288 pixels
    
    
    //var tempPath = "/Volumes/Verbinski/02_SCRIPTING/After_Effects/stockholm/ROOT/EXPLOSIONS/Fireball_side_01/Thumbs/Fireball_Side_01_024.jpg";
    
    
    // create window
    var mWin = new Window('palette');
      mWin.size = [500,500];
      mWin.orientation = 'row';
    
    
    // If you like it, then you better put a scroller on it.
    var scroller = mWin.add('ScrollBar');
      scroller.size = [20,mWin.size[1]-40]
      scroller.minvalue = -5;
      scroller.value = scroller.minvalue;
      scroller.maxvalue = 10000; // tried changing this to all sorts of interesting numbers.
    
    
    //This should move the group, created further down.
    scroller.onChanging = function(){
      grid.location = [grid.location[0],-scroller.value];
    }
    
    
    // "Boundary" for grid (see below)
    var gridArea = mWin.add('panel',undefined,'gridArea');
      gridArea.size = [mWin.size[0]-40,mWin.size[1]-40];
    
    
    // The grid... a digital fronteer... and also container of stuff
    var grid = gridArea.add('panel',undefined,'grid');
      grid.size = [gridArea.size[0]-20,9000000000] // no matter how high I put this, it doesn't change a thing
    
    
    // Just an array for all the images to go
    var clips = [];
    // Total height gets calculated in the populateGrid function.
    var totalHeight = 0;
    
    
    function populateGrid(rows){
      var img;
      for(i=0;i<rows;i++){
      // img = grid.add('image',undefined,tempPath);
      // clips.push(img);
      grid.add('button',undefined,i);
      }
      for(i in clips){
      clips[i].location = [0,(clips[i].image.size[1]*i)]
      }
      // totalHeight = (img.image.size[1]+grid.spacing)*rows;
      // grid.size = [grid.size[0],totalHeight]
      // scroller.maxvalue = totalHeight/2;
    
    
    }
    
    
    // put x number of buttons/images into the grid
    populateGrid(500);
    
    
    // shwo to window
    mWin.show();
    mWin.center();
    }
    

    Reaally hope someone here sees this and can help out me.

    Cheers, Fynn.

    My Control Panel:

    retina 5K, 4 GHz Intel Core i7 iMac

    32 GB of RAM, 512 GB SSD HARD drive

    OSX Yosemite: 10.10.4

    AE: CS6 |  CC 2014: 13.1.1.3

    Aaalrighty, guys. It seems to me have cracked... Sort of...

    David, your version worked quite well, I just modified a bit to get the right calculation.

    The wheel now works as expected and the scroller.maxvalue is calculated as ((number of items) * height of the first item).

    Everything works fine until I have started using the automatic layout manager. The option 'fill' at least makes it really hard to understand the final height of the internal objects. So they must be defined accordingly.

    Indeed, here is my modified code (sorry, @David for resources according to the version string, you may simply copy the scroller.onChanging () and populateGrid() x parts))

    {
    //scroller test
    // I'm using an image of around 512x288 pixels
    
    var tempPath = "YOUR IMAGE HERE";
    
    // create window
    var mWin = new Window('palette');
      mWin.size = [500,500];
      mWin.orientation = 'row';
    
    // If you like it, then you better put a scroller on it.
    var scroller = mWin.add('ScrollBar');
      scroller.size = [20,mWin.size[1]-40]
      scroller.minvalue = 0;
      scroller.value = scroller.minvalue;
      scroller.maxvalue = 3000; // tried changing this to all sorts of interesting numbers.
    
    //This should move the group, created further down.
    var scrollDiary = 0;
    scroller.onChanging = function(){
      var scrollVal = Math.abs(scroller.value)-scrollDiary;
      for(i=0;i		   
  • Need a clarification on the concept of 'World' and 'Group' with regard to CPU reviews

    All-

    I am investigating questions of CPU usage for one of my guests with esxtop. Can someone clarify the concept of 'World' and 'group '? Many of my guests have a 7 or 11 NWLD and I'm trying to figure out exactly this means. What I gather is the following:

    A guest has many worlds

    There is one guest per group

    A group contains many worlds

    Can someone also explain the purpose to describe the use of the processor in this way?

    Megan

    Hello.

    Check it out "[interpretation statistical esxtop | ]. "[http://Communities.VMware.com/docs/doc-9279.pdf]" document.  «[The planner of UC in VMware® ESX 4 |]» [ http://www.vmware.com/files/pdf/perf-vsphere-cpu_scheduler.pdf] "white book is also a good reference.

    Good luck!

  • Apple and Adobe fixed the problem of ink and slides with iPad 2 Air again! It's summer is really long!

    I wonder what the updates on the issue of ink and slides with iPad 2 Air, has been set yet! It's summer is really long!

    No - Sorry to say. But it loks like a case of death for me. We use all this money on paper and pens next time I will wait 1-2 years before trying to summarize fancy gadgets / hardware from Apple / Adobe - I'll stick to Wacom for sure.

  • problem setting users and groups in the areas of security

    Deploy my application ADF of my R2 Jdev11G, but the funniest, it is there is always deletion of the parent to my user setting group layout.

    for example. in Weblogic server: security realms > myrealm > users and groups, and then choose a user can then see 4 tabs 'General', 'Passwords', 'Attributes' and 'Groups' settings for the selected user, and then in the 'Groups' tab, if I choose a group in the column ' Group Parent: available ' in another column "elect." It will be removed later when I re - deploy application to the J-developer the next time, could you let me know how I could avoid this deletion? Thank you!


    Kind regards!

    My question is not clearly described or is it Bug Oracle? Do please help me to thay! Thank you!

    Edited by: xsyang January 6, 2012 01:14

    Edited by: xsyang January 6, 2012 01:25

    See the options in the app (menu)-> Application Properties-> deployment-> Weblogic (subnode under deployment in GR 11, 2), specifically the "migrate the following security objects' 'users and groups' checkbox.

    There is little documentation available on the options here: http://docs.oracle.com/cd/E24382_01/web.1112/e16182/adding_security.htm#BGBFJDED

    CM.

  • sum and group

    Hi everyone, consider the following data

    {code}

    WITH data such AS)

    SELECT 111 usd, 777 native, native2 345, 'SB' GROUP_id 'AND' TYPE OF double UNION ALL

    SELECT usd 222, 222 native, native2 778, 'SB' GROUP_id, 'AND' TYPE OF double UNION all

    SELECT 333 usd, native of 888, 976 native2, GROUP_id 'SB', and ' 1' TYPE OF double UNION all

    SELECT 555 usd, native of 976, 236 native2, GROUP_id "SB2", "4" dual UNION all TYPE

    SELECT 555 usd, native of 987, 1234 native2, GROUP_id "SB2", "AND" TYPE OF double UNION ALL

    SELECT 666 usd, native of 345, 765 native2, GROUP_id "SB2", "ET6" double TYPE

    )

    {code}

    I want to write something like this

    Select group_id,

    -case when type = 'AND' then

    Sum (USD),

    Sum (Native)

    on the other

    Sum (Native)

    Sum (native2)

    end

    from the data

    Group_id group

    I get the error message because I can't have two columns in a case statement.  I know that I can write two different queries and the union of all, but I can run in performance problem because the table is huge.

    is there a way to do something similar to the above query in oracle 10g in a single request (no Union all etc.)

    Hello

    elmasduro wrote:

    Hi everyone, consider the following data

    {code}

    WITH data such AS)

    SELECT 111 usd, 777 native, native2 345, 'SB' GROUP_id 'AND' TYPE OF double UNION ALL

    SELECT usd 222, 222 native, native2 778, 'SB' GROUP_id, 'AND' TYPE OF double UNION all

    SELECT 333 usd, native of 888, 976 native2, GROUP_id 'SB', and ' 1' TYPE OF double UNION all

    SELECT 555 usd, native of 976, 236 native2, GROUP_id "SB2", "4" dual UNION all TYPE

    SELECT 555 usd, native of 987, 1234 native2, GROUP_id "SB2", "AND" TYPE OF double UNION ALL

    SELECT 666 usd, native of 345, 765 native2, GROUP_id "SB2", "ET6" double TYPE

    )

    {code}

    I want to write something like this

    Select group_id,

    -case when type = 'AND' then

    Sum (USD),

    Sum (Native)

    on the other

    Sum (Native)

    Sum (native2)

    end

    from the data

    Group_id group

    I get the error message because I can't have two columns in a case statement.  I know that I can write two different queries and the union of all, but I can run in performance problem because the table is huge.

    is there a way to do something similar to the above query in oracle 10g in a single request (no Union all etc.)

    What are the results you want from these data?  How would you believe that these are good results of these data?

    If type is not in the GROUP BY clause, you can not use it in the SELECT clause, unless it is within an aggregate function.

    Maybe you want something like this:

    SELECT group_id

    SUM (CASE WHEN = "AND" THEN usd native ELSE END) AS sum_1

    , SUM (CASE type WHEN = 'AND' THEN ELSE END native2 native) AS sum_2

    FROM the data

    GROUP BY group_id

    ;

  • connection problems router WRT310N and wrt54gs * with DSL

    Until I can return to my apartment and after IPconfig etc. returns I wanted to see if anyone has had the following problem.

    I had a home wireless network set up with a wrt54gs v 5... I think it was BOM.

    A few days ago I tried to get the network key for the new smartphone and my roommate kind of stupidly locked myself and disconnected my phone then my Office Wireless adapted. passing through the standard power recycles and resets all him remains disconnected in the apartment as well.

    I have DSL through verizon, a toshiba satellite a135 with vista installed, all updates of drivers, and a westell 6100 dsl modem provided by my phone company.

    highlights include:

    (1) two nights now troubleshooting and browsing the forum. I have already exhausted simple corrections of linksys on his questions and help section.

    (2) new router, I wanted anyway a new and estimated that he was the problem. So I bought a wrt310N, hung, and he now obtained, there no longer updated set of firmware

    (3) internet connection is fine when I connect to my laptop directly to a dsl modem.

    router 4) implements the home network wireless very well, but with no internet connectivity

    (5) computer wired to the modem connects to the internet. wired computer for router modem does not connect to the internet. with two routers. If it connects not wired and wireless won't be better.

    I'm getting a little tired and tired, not to mention, I didn't my XBOX live fix to remove the stress of working in a military office all day lol

    everything seems to work until the router tries to connect to my dsl provider, at least as far as I can tell.

    and I'll be on the phone/forums with my ISP as well to make sure that I am not he mess up simply forgetting to fill in an optional field with info mandatory lol.

    so... help?

    still, when I go home for lunch I'll post information and specifications of real hardware if someone a little more savvy I know what to ask.

    Any ideas on where I'm wrong now?

    Fixed issue...

    in the end, it's a problem between the ISP's modem and the router that they helped me understand.

    My DSL service had changed their service, so TRP was no longer how they did the connections. Automatic DHCP was the current form. Following configurations of router DSL online provided inaccurate information. I didn't have the time to check with the ISP until yesterday afternoon when I was finally able to make a phone call and clarify things.

    We put the modem into bridge mode, checked some settings on the router, and then everything is back up now.

  • Problems to recognize and sync with the smartphone Blackberry Q10 with PC

    Thanks in advance to all.

    My BB Q10 was not reproduce my calendar and added duplicates to my contact list whenever I have synced.  So, I uninstalled their software thinking Backberry link I re-install and solve the problem.  Now my PC does not recognize the phone (I tried the 'activate fix mass storage) and BB tech support says that I need to install a "div" ("you must contact Windows to request assistance on their part on the .msi file that your computer needs.") in order to download and re - load in the BB Link software.
    I know that the problem comes from my PC because I connected the phone to my wife and it was immediately recognized, and you are prompted to install the BlackBerry link.
    I know I'm a fossil with Windows 7 and Blackberry, but any help would be appreciated. Thank you

    Like so many people, I had a nightmare trying to connect my Q10 and before that a Z10 for LINK.  After reading a lot of posts become completely disillusioned, until I found a post on the opening of the control panel/Device Manager and see if BB Q10 was listed and had a yellow triangle next to it and then try to reinstall the drivers.

    So I plugged my BB to the computer with a USB cable

    Open panel / but Device Manager there is no device listed outside the "RIM Mass Storage Device."

    What made me think...

    With the always-connected BB, on BB, I opened the settings / storage access and disabled USB mass storage.

    On the control panel / Device Manager, immediately "RIM Mass Storage Device" icon in the taskbar, a window and disappeared popped up saying "search drivers."

    This has changed then automatically to "Install drivers" and "Finish."

    In Control Panel / Device Manager a new device popped up in the area of 'No' called 'peripheral network RIM.

    Then I opened the link and it is immediately connected to my BB Q10...

    Then I went there immediately disconnect and link back to the Q10 spilled the USB Mass Storage 'OFF '.

    Certainly, there is a bug here...

    I lost several hours tinkering with this whole process, and it's a nightmare of flashing.  While this may not work for everyone, I hope this works for some of you...

  • Problem of color and Lag with Flash.

    Hi, I have this very annoying problem with flash. The photos below show what I mean by the problem of the color and the video shows the offset. I have impression projected both videos to show you how to receive. I've included links for you to see the video.
    youtube.jpg

    Without even looking at the video, I guess you can see that there is something wrong already, to compare watch them the vid.

    Link to the video (Yotube)

    youtube2.jpg

    This is the worst that a video is already well that sometimes I get a green screen instead of a video

    Link to the video (Yotube)

    The problem of Lag, I sometimes have with videos (I have recorded my screen):

    Link to the video (Yotube)

    PLEASE NOTE:

    • I tried to reinstall or uninstall the flash player (I used adobe flash uninstaller)
    • I also experienced a two errors while watching a video. the video card (Nvidia GeForce 8500 GT) gave my windows 7 (32 bit) an error and the screen flashed but I then recovered but the video does not.
    • I think there could be a problem with my monitor recent update and also the use of two screens. Maybe the graphics card just cannot be considered.
    • I checked the different browsers and the same thing happening even IE9 HTML5!

    Try turning off hardware acceleration.

  • Problems in CS3 and AS3 with embedded fonts

    Hello. I recently downloaded the trial version of CS3 to test. I am an experience AS2 developer, and have 10 years of C, C++, c#, Java, PHP... programming experience on MAJOR projects starting before flash.

    I tried to use a font embedded in AS3 with a dynamically created textfield. I tried all the examples of ActionScript 3.0 Cookbook from O'Reilly. They suggest using the [Embed] metadata tag, but quite honestly it doesn't do anything in CS3. I got the size selected report option, and it clearly shows by the size of file that the police is not present in the SWF file.

    Then I tried to do like I did in Flash 8. There still no luck. My TextField exists, but it is simple no rendered police... Here is my piece of code.

    In my library, I have a symbol called arialBold. In the connection settings, I have "Export for ActionScript" checked and "Export in first frame" checked. The class is "arialBold" but I wonder if it's true? and the Base class is 'flash.text.Font.

    I tried all the variations I could think. I have to do something wrong. You can find my file here:

    http://www.newcommerce.ca/AS3/fonttest.fla

    Thanks for your help! You can solve this problem, I would be very happy!



    Well, that's the way it was supposed to work, but I think what integrate coding Flex 2 and does not work with actionscript 3.0.

    Here's something that works: embed a font as you did for a.s. 2 and give it a class name (say _comicSansReg). You can then use:

  • VS2012 problem of configuration and deployment with scatter chart

    I've recently updated one of my programs of VS2008 to VS2012.  I also had Measurement Studio 2009 and upgraded to 2013.  Since Microsoft dropped its installation and deployment in VS2012, I'm looking to use Flexera Express to create an installer.  My app contains a form that contains a scatterplot graph control that must be deployed on both Win7 and XP computers.  I tried to force the compilation to .NET framework 4.5, but that only supports XP.  I demoted the .NET framework down to 3.5.  I noticed that I had to change the references OR whenever I changed the .NET framework.  I only had references to the NationalInstruments.UI, NationalInstruments.UI.WindowsForms and NationalInstruments.Common.  When I build the installation it requires me to explicitly declare the redistributable packages.  So I chose the package OR Measurement Studio Windows Forms Support and automatically selects the load at the time of Design and common User Interface Support (dependencies I guess).  But after I create this version of installation and install it on a system, I get the following message when you attempt to initialize the scatter chart control:

    Could not load file or assembly 'NationalInstruments.UI, Version 8.9.35.246, culture = neutral, PublicKeyToken = 18cbae0f9955702a' or one of its dependencies.  The system cannot find the specified file.

    Y at - it a redistributable package I'm missing?  I tried to add the base components for the execution of Measurement Studio, but get the same error.

    I tried to use Wix, but ran out of patience, trying to figure out this one.  Any help is greatly appreciated.

    In general, when controls utilities deploying Measurement Studio you refer to this documentation for the required dependencies for the merge modules:

    http://digital.NI.com/public.nsf/allkb/6677098983C36F9086256CFE007F457A?OpenDocument

  • Some build-in panels are grouped with my plugin Panel in InDesign CC

    My settings for panelist look like this:

    resources LocaleIndex (kSDKDefPanelResourceID)

    {kViewRsrcType,

    {kWildFS, k_Wild, kSDKDefPanelResourceID + index_enUS}

    };

    / * Definition of panelist.

    */

    resources involved (kSDKDefPanelResourceID)

    {

    {

    1 group in the list

    kSDKDefPanelResourceID, / / resource ID for this Panel (use SDK by default ID rsrc)

    kMyPluginID, / / ID of the plugin which holds this Panel

    kIsResizable,

    kMTPanelWidgetActionID, / / Action ID to show/hide Panel

    "MyPlugin:Test", / / appears in the list window.

    "", / / Substitute the form menu path ' hand: Foo "If you want your palette in the second menu item to place

    0.0, / / menu replacing the position of the alternative Menu to determine the order of the menu

    kMyImageRsrcID, kMyPluginID, / / Rsrc ID, ID Plugin for a PNG icon resource to use for this palette (when it is not active)

    c_Panel

    }

    };

    resources MTPanelWidget (kSDKDefPanelResourceID + index_enUS)

    {

    __FILE__, __LINE__, / / macro location

    kMTPanelWidgetID, / / WidgetID

    kPMRsrcID_None, / / RsrcID

    kBindAll, / / Binding (0 = none)

    0, 0, 320, 386, / / framework: left, top, right, bottom.

    kTrue, kTrue, / / Visible, Enabled

    kTrue, / / clear the background

    kInterfacePaletteFill, / / Color Erase

    kMTPanelTitleKey, / / name of Panel

    {

    }

    "MyPlugin" / / name of contextual menu (internal)

    };

    The problem is that when I click on the window-> MyPlugin-> Test liquid integrated panels layout of the article and references are also open and grouped with my Panel. I don't understand what I'm doing wrong. The situation is the same with all the examples in the sdk that have signs. Help, please. 10 x in advance.

    My previous post was that this panelMgr-> GetPanelFromWidgetID (kMyPanelWidgetID) does not find the Panel when it is called in the initializer.

    I'm now deep - search the trees from the GetRootPaletteNode paletteRef, using PaletteRefUtils methods. For kTabPanelContainerType, I used panelMgr-> GetPanelFromPaletteContainer() to check the ID of widget, fortunately callers already works. For other types, I just go down the children.

    Three steps more to move the paletteRef found in a new floating window:

    columnRef = PaletteRefUtils::NewFloatingTabGroupContainerPalette(); kTabPaneType

    groupRef = PaletteRefUtils::NewTabGroupPalette (column); kTabGroupType

    PaletteRefUtils::ReparentPalette(myPanelRef,groupRef,PaletteRef());

    If you have several panels, Iterate step 2 + 3 to create groups (lines) per Panel, or just step 3 if they all end up stacked.

    Edit: I can find why GetPanelFromWidgetID did not work: apparently initializer priority is considered by plugin, so one of my signs in a plugin different just was not yet registered. Forget all that deep-search tips.

  • Local users and groups is missing from computer management

    I can't find the local users and groups folder in computer management. He is absent.

    Hello

    Advanced management tools are only available in the Windows 8 Pro version. It seems that you have the standard version of Windows 8. Windows and Windows 8 RT have local users and groups with disabilities.

    You can also check the wire and check.

    The local users and groups missing

    Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

  • Update with the join and group by

    Hi all

    I'm currently updating multiple columns in a table from an inner join query.
    First one recover the affected rows and values that I need for the update (which I call this subquery ED_Query).
    It is important to note that this subquery has a group of and and the having clause.

    My first attempt (using the query running in the SQL Server query) fails:

    SQL > update ED_Update
    2 set ED_Update.dtHoraInicioReal = ED_Query.dtHoraInicioReal,
    3 ED_Update.dtHoraFinReal = ED_Query.dtHoraFinReal,
    4 ED_Update.fPorcentajeRealizado = ED_Query.fPorcentajeRealizado
    HISTORICOS_AVANZA 5. HSAE_HIS_EXPEDICIONDIARIA ED_Update
    inner join 6)
    7. select distinct ED.iIdExpedicion, ED.iIdExpedicionDiaria,
    8 MAX (PT.iOrdenEnTrayecto) + 1 as iNumParadas,
    9 MAX (HPP.iOrden) as iOrdenUltimaParada,
    10 MIN (dtHora_LlegadaReal + iTiempoEnParada /(24*60*60)) as dtHoraInicioReal,
    11 MAX (dtHora_LlegadaReal) as dtHoraFinReal,
    12 100 * cast ((MAX (HPP.iOrden) + 1) as float) / cast ((MAX (PT.iOrdenEnTrayecto) + 1) as float) as fPorcentajeRealizado
    13 of HISTORICOS_AVANZA. ED HSAE_HIS_EXPEDICIONDIARIA
    14 left join HISTORICOS_AVANZA. HSAE_HIS_HORAPASOPARADA HPP
    15 ED.iIdExpedicion = HPP.iIdExpedicion and ED.dtJornada = HPP.dtJornada
    16 left join AVANZA. SAE_URB_PARADASTRAYECTO PT on ED.iIdLinea = PT.iIdLinea and ED.iIdTrayecto = PT.iIdTrayecto
    17 where ED.dtJornada = TO_DATE (January 14, 2013 ',' DD/MM/YYYY ') and ED.iIdExpedicion in (-131076)
    18 ED.iIdExpedicion, ED.iIdExpedicionDiaria, ED.dtHoraInicioReal, ED.dtHoraFinReal group
    19 having ED.dtHoraInicioReal <>min (dtHora_LlegadaReal + iTiempoEnParada /(24*60*60))
    20 or ED.dtHoraFinReal <>max (dtHora_LlegadaReal)
    (21) ED_Query
    22 we ED_Update.iIdExpedicionDiaria = ED_Query.iIdExpedicionDiaria;

    ERROR on line 5:
    ORA-00933: SQL not correctly completed command.

    Subquery (ED_Query) work fine in Oracle, so I suspect that the problems are when I mix with the update clause.

    SQL > select distinct ED.iIdExpedicion, ED.iIdExpedicionDiaria,.
    2 MAX (PT.iOrdenEnTrayecto) + 1 as iNumParadas,
    3 MAX (HPP.iOrden) as iOrdenUltimaParada,
    4 MIN (dtHora_LlegadaReal + iTiempoEnParada /(24*60*60)) as dtHoraInicioReal,
    5 MAX (dtHora_LlegadaReal) as dtHoraFinReal,
    6 100 * cast ((MAX (HPP.iOrden) + 1) as float) / cast ((MAX (PT.iOrdenEnTrayecto) + 1) as float) as fPorcentajeRealizado,
    7 ED.dtHoraInicioReal ED_dtHoraInicioReal, ED.dtHoraFinReal as ED_dtHoraFinReal, ED.fPorcentajeRealizado as ED_fPorcentajeRealizado
    8 of HISTORICOS_AVANZA. ED HSAE_HIS_EXPEDICIONDIARIA
    9 left join HISTORICOS_AVANZA. HSAE_HIS_HORAPASOPARADA HPP
    10 on ED.iIdExpedicion = HPP.iIdExpedicion and ED.dtJornada = HPP.dtJornada
    11 left join AVANZA. SAE_URB_PARADASTRAYECTO PT on ED.iIdLinea = PT.iIdLinea and ED.iIdTrayecto = PT.iIdTrayecto
    where the ED.dtJornada 12 = TO_DATE (January 14, 2013 ',' DD/MM/YYYY ') and ED.iIdExpedicion in (-131076)
    13 group of ED.iIdExpedicion, ED.iIdExpedicionDiaria, ED.dtHoraInicioReal, ED.dtHoraFinReal, ED.fPorcentajeRealizado
    14 after ED.dtHoraInicioReal <>min (dtHora_LlegadaReal + iTiempoEnParada /(24*60*60))
    15 or ED.dtHoraFinReal <>max (dtHora_LlegadaReal);

    IIDEXPEDICION IIDEXPEDICIONDIARIA INUMPARADAS IORDENULTIMAPARADA DTHORAINI
    ------------- ------------------- ----------- ------------------ ---------
    DTHORAFIN FPORCENTAJEREALIZADO ED_DTHORA ED_DTHORA ED_FPORCENTAJEREALIZADO
    --------- -------------------- --------- --------- -----------------------
    -131076 5662 406 15 JANUARY 13
    15 JANUARY 13 JANUARY 15, 13 15 JANUARY 13 0

    -131076 5663 406 15 JANUARY 13
    15 JANUARY 13 JANUARY 15, 13 15 JANUARY 13 0

    -131076 5664 406 15 JANUARY 13
    15 JANUARY 13 JANUARY 15, 13 15 JANUARY 13 0

    After reading this forum, I have change the query and try the following:

    SQL > UPDATE
    () 2
    3. select distinct ED.iIdExpedicion, ED.iIdExpedicionDiaria,
    4 MAX (PT.iOrdenEnTrayecto) + 1 as iNumParadas,
    5 MAX (HPP.iOrden) as iOrdenUltimaParada,
    6 MIN (dtHora_LlegadaReal + iTiempoEnParada /(24*60*60)) as dtHoraInicioReal,
    7 MAX (dtHora_LlegadaReal) as dtHoraFinReal,
    8 100 * cast ((MAX (HPP.iOrden) + 1) as float) / cast ((MAX (PT.iOrdenEnTrayecto) + 1) as float) as fPorcentajeRealizado,
    9 ED.dtHoraInicioReal ED_dtHoraInicioReal, ED.dtHoraFinReal as ED_dtHoraFinReal, ED.fPorcentajeRealizado as ED_fPorcentajeRealizado
    HISTORICOS_AVANZA 10. ED HSAE_HIS_EXPEDICIONDIARIA
    11 left join HISTORICOS_AVANZA. HSAE_HIS_HORAPASOPARADA HPP
    12 on ED.iIdExpedicion = HPP.iIdExpedicion and ED.dtJornada = HPP.dtJornada
    13 left join AVANZA. SAE_URB_PARADASTRAYECTO PT on ED.iIdLinea = PT.iIdLinea and ED.iIdTrayecto = PT.iIdTrayecto
    14 where ED.dtJornada = TO_DATE (January 14, 2013 ',' DD/MM/YYYY ') and ED.iIdExpedicion in (-131076)
    Group 15 of ED.iIdExpedicion, ED.iIdExpedicionDiaria, ED.dtHoraInicioReal, ED.dtHoraFinReal, ED.fPorcentajeRealizado
    16 having ED.dtHoraInicioReal <>min (dtHora_LlegadaReal + iTiempoEnParada /(24*60*60))
    17 or ED.dtHoraFinReal <>max (dtHora_LlegadaReal)
    18)
    19 SET ED_dtHoraInicioReal = dtHoraInicioReal,
    20 ED_dtHoraFinReal = dtHoraFinReal,
    21 ED_fPorcentajeRealizado = fPorcentajeRealizado;

    ERROR on line 2:
    ORA-01732: operation non-legal data manipulation on this point of view

    Little help?

    Thanl in advance.

    Published by: 984483 on 28-ene-2013 01:48

    Hello

    Thanks for posting the CREATE TABLE and INSERT.
    Don't forget to post the desired results of these sample data, i.e. the content of the or the tables changed after the UPDATE is made.

    Is that what you want ed_update to look like after that everyhting is finished?

    DATE01      NUMBERMAX  NUMBERSUM
    ---------- ---------- ----------
    01/01/2013         30         60
    02/01/2013          0          0
    03/01/2013          0          0
    

    If so, here's a way to do it:

    UPDATE     ed_update     u
    SET     (numbermax, numbersum) =
         (
                 SELECT  MAX (number01)
              ,     SUM (number01)
              FROM     ed_query
              WHERE     date01     = u.date01
         )
    WHERE     date01     = TO_DATE ('01/01/2013', 'DD/MM/YYYY')   -- If wanted
    ;
    

    In Oracle, INNER JOIN works only in the FROM clause of a SELECT statement.
    When you want to update a table with values from another table, you can do a subquery correlated (as I showed above) or use the MERGER instead of UPDATE.

  • Why the books are grouped and preinstalled with the operating system?

    It's complaints

    My Portege has Windwosw Vista. I didn't want to buy Vista, but they were only selling with him and no other choice was possible to purchase.

    First of all, my laptop had problems to install Windows updates. I could not connect my institution's Internet System. I had to reinstall the system again.
    It's a waste of time!

    After re-installation of the button for the sound on the outside Panel does not work correctly.

    Also, when I try to stop the laptop sometimes it restarts itself - he doesn't stop!

    Secondly, I had a problem with the laptop, when an opportunity to visit a well-known site, it serves to block itself.
    Once, when he is blocked, I had to restart and its screen remained black. They took for repair. It was delivered later - repaired, but with a defect on the screen!
    What a... workers!

    When I bought this laptop he had an offer with the update of Vista with Windows 7 after their release.
    Wonderful. But just note, Toshiba has the highest price of the offer, compared to its competitors - 30 (or £) against 15 for others, which of course I'm not going to pay.

    I already paid for Vista, which is incredible, and I knew, but I had not choice not to buy!

    All right, so there is still competition in the market, several possibilities are present - install Windows cracked, switch to Linux or just buy an Apple!

    Please, take this comment seriously! And please, stop with group buying, no matter what the benefit is. It won't work for long.

    Hi mate

    Fact is that most of the laptop manufacturers sell the computer and laptop computer with a preinstalled operating system. So I wouldn't blame Toshiba or other brands for which

    You get a new computer/laptop with a new OS.
    During the past 20 years, Microsoft released 3.0 Win, Win 95, Win 98, Win NT, W2k, Win XP, Win ME, Vista and Win 7, I remember that all my computers or laptops were grouped with these operating systems

    Toshiba offers the notebook with a clean image and you can also create a recovery disk (so don t need to buy anything if you need t n)
    Of course, each of us can install a clean OS, but there are a lot of people who are happy with such image pre-installed because everything is pre-installed and configured.

    Many people have no knowledge of computer wide and are really recognizing that everything is pre-installed and the configuration does not have a lot of time

    With regard to the question of the laptop;
    What to say; you had a bad luck that something was wrong with the laptop. This can still happen that my new LCD TV other manufacturer, was dead after two weeks, I called ASP, then replaced the screen now is ok

Maybe you are looking for

  • Why I can't remove applications in Launchpad?

    What I wanted to do I have some third-party applications that I wanted to remove my Mac mini. I looked online Apple online help and he informed me that the quickest way was to open the dashboard, click on the application icon until all the icons that

  • IMac G5 to go back factory settings

    How can I remove all documents and set up my old G5 iMac to factory settings?

  • ENVY dv6-7320el: problems with touchpad

    Hello I'm new here, so I don't know if this is the right place for this question, but here goes: I had problems with my touchpad, precisely with the two-finger-roll. It would sometimes stop working, but then set a few minutes. Today that work complet

  • (Redirected) 10 Windows touch screen does not work

    I've recently updated to windows 10 and my touch screen does not work. I believe that the driver is no longer installed. Any help would be great.

  • can not download files via FTP with Windows 7. I have 7 professional 64 bit.

    I downloaded a free Mozilla ftp client, but still can't download. However, I can download. The file size is about 600 MB. I completely disabled the firewall of Windows 7. It's more than a little frustrating... I'd be willing to use the Windows Explor