Need to use Group By but only want to group some of the columns not all

Hello all! I am having some issues here. I am rather new to SQL and I am getting stuck with grouping. I have the query below but I only want to group by these columns, instead of all the columns in my select statement.
ah.fund,
ah.dept,
ah.org,
ah.acct,
t.fund,
t.dept,
t.org,
t.acct
This will eventually go into Oracle reports builder. Is there any way I can archive this at all? The query will return all the t for a given time period, but they need to be grouped by the fully qualified account number which consists of the fund, dept, org and acct columns.
Thanks in advance!
SELECT ah.fund,
     ah.dept,
     ah.org,
     ah.acct,
     LPAD(ah.fund,3,0)||LPAD(ah.dept,2,0)||LPAD(ah.org,4,0)||SUBSTR(ah.acct,1,2) acct_no,
     LPAD(ah.fund,3,0)||LPAD(ah.dept,2,0)||LPAD(ah.org,4,0)||ah.acct acct_no1,
     t.fund,
     t.dept,
     t.org,
     t.acct,
     t.ACTIVITY_DATE,
     t.TYPE,
     t.AMT,
     t.description,
     t.TRANS_NO,
     t.RECEIPT_NO,
     DECODE(t.PO_NO,NULL,t.JOURNAL_NO,t.PO_NO) J_NO,
     DECODE(t.WARRANT_NO,NULL,t.WIRE_NO,t.WARRANT_NO) W_NO,
     t.VENDOR_NO,
     v.name||' ' ||v.first_name name,
     MIN(ah.eod_date)
FROM ah,
     t,
     v
WHERE ah.fund BETWEEN SUBSTR(:p_acct_from,0,3) AND SUBSTR(:p_acct_to,0,3)
     AND ah.dept BETWEEN SUBSTR(:p_acct_from,4,2) AND SUBSTR(:p_acct_to,4,2)
     AND ah.org BETWEEN SUBSTR(:p_acct_from,6,4) AND SUBSTR(:p_acct_to,6,4)
     AND ah.acct BETWEEN SUBSTR(:p_acct_from,10,5) AND SUBSTR(:p_acct_to,10,5)
     AND FLOOR(ah.acct/10000) IN (6,8)
     AND SUBSTR(ah.acct,3) != '000'
     AND ah.eod_date BETWEEN :p_from_date-1 AND :p_to_date
     AND t.fund (+) = ah.fund
     AND t.dept (+) = ah.dept
     AND t.org (+) = ah.org
     AND t.acct (+) = ah.acct
     AND TO_DATE(t.activity_date, 'dd-mon-yy') >= TO_DATE(:P_FROM_DATE,'dd-mon-yy')
     AND TO_DATE(t.activity_date, 'dd-mon-yy') <= TO_DATE(:P_TO_DATE,'dd-mon-yy')
     AND t.type IN( 'PI','JE','PR','VD','VU','AC','AD')
     AND (
          (:p_year = TO_CHAR(CURRENT_DATE,'YYYY')
          AND (t.po_no IS NULL
          OR (select TO_CHAR(open_date,'YYYY') FROM r WHERE po_no = t.po_no ) = TO_CHAR(CURRENT_DATE,'YYYY') ) )
          OR ((select TO_CHAR(open_date,'YYYY') FROM r WHERE po_no = t.po_no ) = :p_year )
AND v.vendor_no (+) = t.vendor_no
GROUP BY ah.fund,
     ah.dept,
     ah.org,
     ah.acct,
     t.fund,
     t.dept,
     t.org,
     t.acct,
     t.ACTIVITY_DATE,
     t.TYPE,
     t.AMT,
     t.description,
     t.TRANS_NO,
     t.RECEIPT_NO,
     DECODE(t.PO_NO,NULL,t.JOURNAL_NO,t.PO_NO),
     DECODE(t.WARRANT_NO,NULL,t.WIRE_NO,t.WARRANT_NO),
     t.VENDOR_NO,
     v.name||' ' ||v.first_name
ORDER BY LPAD(ah.fund,3,0)||LPAD(ah.dept,2,0)||LPAD(ah.org,4,0)||SUBSTR(ah.acct,1,2),
     LPAD(ah.fund,3,0)||LPAD(ah.dept,2,0)||LPAD(ah.org,4,0)||ah.acct;

In reports builder you can group the columns without having to group it in your query. It is also known as the break report which contains multiple groups in its data model.
    |            Q_1               |
                  |
                  |
    |       GRP_department         |
    | dept_no                      |
    | dept_name                    |
                  |
                  |
    |         GRP_employee         |
    | emp_no                       |
    | emp_first_name               |
    | emp_last_name                |
    | emp_middle_name              |
    | emp_date_of_birth            |
    | ...                          |
    ------------------------------

Similar Messages

  • If I use Nav. Attribute X---Y in report, some of the values not assigned.

    Hi All,
    We r using  a navagational attribute like X-Y  in our report. X is Char. Y is Attribute. If I use Nav. Attribute X-Y in report, some of the values r not assigned. If i use display attibute Y under charectiristic X , I am getting correct values. why?
    Thanks in Advance

    Take the master data table name...go to se14...give the table name..click Edit...choose option Activate and adjust database..
    Run attribute change run
    Check and revert.
    Regards
    Gajendra

  • How do I create photo album folders or files ? As it stands, ihave some 500 pics saved but only want to play some of them for a slideshow presentation?

    How do I create file folders or photo albums to save photos in specific designated area for subsequent playback as a slideshow. As it stands, I have approx 500 photos in new I Pad 2, however need to only play about 30 in a slideshow. Thank you

    For the Photos app you need to put the photos into different folders on your computer and then sync those folders to the iPad - you need to sync all the photos that you want on the iPad in one go, as only the most recent photo sync remains on the iPad. There are third-party apps that you can copy photos to on the iPad which I think might allow you to do slideshows, but I havn't used any of them.
    With iOS 5 in the Autumn you will (assuming that it makes it to the final release) be able to (from http://www.apple.com/ios/ios5/features.html#photos) :
    Even organize your photos in albums — right on your device.

  • I am considering switching from MIE to Firefox. But I need to use an outdated version (7.3.1) of QuickTime, and I do not want Firefox to update it. If I installed Firefox, how would I prevent this?

    I am considering switching from MIE to Firefox. But I need to use an outdated version (7.3.1) of QuickTime, and I do not want Firefox to update it. If I installed Firefox, how would I prevent this?

    Firefox doesn't update plugins like that. The worst you might see is a "nag" from Firefox after an update, about that plugin being outdated; and you can dismiss that "nag" by just closing it.

  • I am trying to pair my cell phone and tablet using Messages   App,  but only MMS messages will come through on my tablet.   I've tried pairing and unpaired,  reinstalling app on my tablet,  and can't figure it out.   Any idea how to fix this?

    I am trying to pair my cell phone and tablet using Messages   App,  but only MMS messages will come through on my tablet.   I've tried pairing and unpaired,  reinstalling app on my tablet,  and can't figure it out.   Any idea how to fix this?
    Thanks

    I Shared my most ridiculous situation but didn t log under your problem.
    sorry, I gave you your answer under sunshine99 or Dianna. I want out and you want in.
    if you not find just email me at [removed]
    thanks
    Personal information removed as required by the Verizon Wireless Terms of Service
    Message was edited by: Admin Moderator

  • We have two company user,till now there are using same URL.but they wanted to access particular URL to related company user in single server

    Hi Experts,
    We have two company user,till now there are using same URL.but they wanted to access particular URL to related company user in single server.
    As per my knowledge ,it is possible through create new aliases with different URLs in network.
    But i dont how to create. Please help on this.
    Thanks in advance.
    Regards,
    Prasad

    Hi Prasad,
    Please explain in clear english as to what is your requirement. I got lost after "two company user" . I suppose it means there are users from two separate company: A and B. They were using same portal till now: http://commonportal:50000/irj/portal.
    Now they need different urls - specific for each company say companyAportal.com and companyBportal.com. But still the same old common portal in the end.
    If that's your requirement please search the forum with correct terms, else "Google".
    Thanks,

  • I want to add an application like winrar useing rar file so i can auto download it all thet i have is a zip fill but i want a rar file too the option to auto download it is gray so i cant use it plz help me.

    i want to add an application like winrar useing rar file so i can auto download it all thet i have is a zip fill but i want a rar file too the option to auto download it is gray so i cant use it plz help me.
    == This happened ==
    Every time Firefox opened
    == all the time

    Here is the answer: Not an add on or plug-in! In fact you can get rid of all those useless plugins and add-ons! Go and get it. Im using the Alpha version right now and it works great. Works better then anything else .......add multiple links for all files sit back and relax. Its all done for you with no more intervention on your part! Check it out!
    http://wordrider.net/freerapid/
    Only one downside to this. No proper installer. You will have to copy the files to your respective programs folder.
    C:\Program Files\FreeRapid or C:\Program Files (x86)\FreeRapid
    Then create shortcuts to your desktop from FRD app. Thats it then start downloading!
    By the way this not an add. I just spent the whole night looking for the solution to this problem because I was so frustrated with the whole thing. I download tons of files and I have lots of other projects going and I dont have time for all this nonsense with RapidShare and Firefox. Hope this helps some other poor souls out there!

  • HT4915 I have icloud music on my phone but NOT in my itunes libarary, and I want to delete some of the icloud content. I DO NOT use itunes match.

    I have icloud music on my phone but NOT in my itunes libarary, and I want to delete some of the icloud content. I DO NOT use itunes match.

    iDevices are not and have never been backup devices.
    Authorizing a computer does not cause media to magically appear.
    Media is only where the user puts it.
    Copy the ENTIRE iTunes folder from the old computer to the new computer.

  • I have intel mac  10.411, want to access iTunes, won't let me unless upgrade tp itunes 10, but it needs OSX 10.5. I just want to download some music, not upgrade my operating system. It's not THAT old. Ideas?

    I have intel mac  10.411, want to access iTunes, won't let me unless upgrade tp itunes 10, but it needs OSX 10.5. I just want to download some music, not upgrade my operating system. It's not THAT old. Ideas?

    As long as you don't need all the bells and whistles of the iTunes Store such as Ping, and don't need to sync an iOS device running iOS 4.x, then iTunes 9.2.1 should work for you. It should be available via Software Update, but if not, you can still get it here:
    http://support.apple.com/kb/DL1056
    but it would be best to upgrade your Mac to Mac OS X 10.5 or 10.6, since it's probable that eventually the iTunes Store will no longer support iTunes 9.x.
    Regards.
    P.S. Mac OS X 10.4 was discontinued three and a half years ago, so yes, it's getting rather long in the tooth. Cheers.

  • Error in encoded stream: needed 4 valid base64 characters but only got 3 be

    Folks,
    We are trying to copying a file in to temp directory. But we keep getting this error. Please help..
    import java.io.FileOutputStream;
       myfile = File.createTempFile(atType, fName,
                       new File(FileUtils.getTmpRootDir()));
               output = new FileOutputStream(myFile); java.io.IOException: Error in encoded stream: needed 4 valid base64 characters but only got 3 before EOF, the 10 most recent characters were: "-A-G-EASDF"
    _Thanks Much
    :rolleyes:

    What are the values of atType and fName? Also, what does getTmpRootDir() do? Also, which of those two lines of code you posted does the error occur on?

  • Does anyone know of a good online video instruction on how to put together a photo slideshow in the new iMovie version. I found uTube videos using imported videos, but I want to use photos in iPhoto.

    Does anyone know of a good online video instruction on how to put together a photo slideshow in the new iMovie 11 version. I found uTube videos using imported videos, but I want to use photos in iPhoto. I'm very familiar with how to do this in the pervious version, but it's no so intuitive in the new version.

    Has anyone tried this one.. I am not sure if I am allowed to post information about other products... so if I am not please delete this part of my message.
    New Trent Arcadia Pack IMP70D 7000mAh?

  • HT201077 I shared a photo stream of 174 pictures but only 20 are showing up in the folder that was sent out. Any solutions?

    I shared a photo stream of 174 pictures but only 20 are showing up in the folder that was sent out. Any solutions?
    Help much appreciated!

    Upload to the shared Photo Streams can take a long time. Sometimes hours. Did the photos appear by now in the stream?
    Is the iCloud status o.k. ( iCloud Support webpage)?
    Did you share from your mac or from a mobile device? And where are you checking the stream? On your Mac? If you are uploading from a mobile device - is the battery fully charged? Uploading to the Photo Stream is the first that will be suspended, if the device needs charging.
    have ypu exceeded any limits? Daily hourly upload rates? http://support.apple.com/kb/HT4858
    Regards
    Léonie

  • I need to cancel my account, but I cannot verify my identity over the phone

    I need to cancel my account, but I cannot verify my identity over the phone as I do not know what pin I entered, or what security answer I put in, and of course there are no recent numbers in my phone, but I'm still me, and I'm still the one who pays my bill, and I still need to close my account, and I need a way to do that. Honestly I'm getting quite frustrated here and am considering starting a lawsuit or submitting my story to a newspaper, I like verizon and thought I would get my next phone under verizon as well, but now I'm not so sure. But whatever the the case, even if I need to go somewhere in person with my id to prove that I'm the owner of my account, I need it closed.
    I really hope that someone here can help me solve this issue, or direct me to someone who can solve this issue for me. I think that the better business bureau would find it as atrocious as I do that a person could get looped into payments that they don't want and cannot get out of, now I know that this was not the intention, but I really do need to cancel my plan because I cannot afford the bill.

    How To: Direct Message  and  AyaniB_VZW

  • HT201855 I only want my email deleted from my iPad NOT the sever...how can I do that? Thanks!

    I Only want to delete mail from my iPad not the server.  The memory on my iPad is almost gone and it is working slow.  I still want to look my mail up on my laptop.
    thanks!

    See this -> Using a POP account with more than one device - Apple Support
    The memory on my iPad is almost gone and it is working slow
    FYI: Email messages take up very little space so you should consider removing other items.
    See this -> See how much storage you've used on your iPhone, iPad, and iPod touch - Apple Support

  • Hi, is there a support for development ? I have a idear for a docking station. But i want to know some more details about the licence from apple and so on. Is there a special call center ??

    Hi, is there a support for development ? I have a idear for a docking station. But i want to know some more details about the licence from apple and so on. Is there a special call center or can i call the normal support for my country ???

    For liscensing of iOS related hardware? You'd need to contact the Made For iPod Program.
    <http://developer.apple.com/ipod/>
    Their contact address is <[email protected]>

Maybe you are looking for

  • Can i uninstall and reinstall itunes w/out losing my library?

    If so how? For some reason my itunes will no longer sync with my ipod.

  • How to move a file when startup disk is full?

    My macbook start up disk is full, apparently. I've tried deleting things and nothing has worked. I need to safely get a video file, in mp4 from Iphoto onto a usb drive. Iphoto will not let me put the file on desktop or move anywhere. What do I do? He

  • ANSWERED Pulseaudio doesn't recognize speaker until headphones plugged

    Hi, first time poster here. Having this strange problem where, upon boot, my laptop can't play audio through the speakers until something is plugged into the headphones jack, and it then immediately recognizes the speakers. By default it always tries

  • Oracle Apps Customizations

    I would like some information on best practices for Oracle Apps Customizations – specifically database objects (i.e. tables, PLSQL). I wanted to know the pros/cons for isolating the custom database objects in their own custom schemas or putting all t

  • Noise reduction did nothing - no instructions for the process

    I entered noise reducer in the help menu and "what's new in imovie comes up" - I am looking for info on the process to apply noise reduction and nothing applied even two layers down in what came up in "what's new in imovie". I have bought the book iM