Query: How do you add a Total field and a Calculation

Hi Experts,
I have writen the following query with the Query Generator. I have 2 questions:
I need to display the Total of column T2.[OpenSum]. How do I write this in the Query?
I need the T2.[OpenSum] to be multiplied with T3.[Commission] - on the line and put into a newly created column and then have a total at the bottom. How do I do this?
SELECT T0.[DocNum] AS 'Incoming Payment', T0.[DocDate] AS ' Incoming Payment Date', T0.[CardCode], T0.[CardName],  T3.[SlpName], T3.[Commission], T1.[DocNum] AS 'Invoice Number', T2.[OpenSum] AS 'Invoice Line Amounts'
FROM ORCT T0  INNER JOIN OINV T1 ON T0.DocEntry = T1.ReceiptNum INNER JOIN INV1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OSLP T3 ON T1.SlpCode = T3.SlpCode
WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1] AND  T3.[SlpName] =[%2]
ORDER BY T1.[DocNum]
Any help would be greatly appreciated!
Thanks!
Marli

Hi Marli:
Try this one for a new column:
SELECT T0.[DocNum] AS 'Incoming Payment', T0.[DocDate] AS ' Incoming Payment Date', T0.[CardCode], T0.[CardName],  T3.[SlpName], T3.[Commission], T1.[DocNum] AS 'Invoice Number', T2.[OpenSum] AS 'Invoice Line Amounts', T2.[OpenSum] * T3.[Commission] AS 'Commission Amount'
FROM ORCT T0  INNER JOIN OINV T1 ON T0.DocEntry = T1.ReceiptNum INNER JOIN INV1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OSLP T3 ON T1.SlpCode = T3.SlpCode
WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1] AND  T3.[SlpName] =[%2]
ORDER BY T1.[DocNum]
As for the total, if you only want to have a grand total, just CTRL + click column head.
Thanks,
Gordon

Similar Messages

  • How do you add a mobile number and a home number to a contact on a 4S

    How do you add a mobile number and a home number to a contact on an iPhone4S?

    First add the mobile number. Once you've done that there should be another field that shows 'iPhone". Tap on 'iPhone' and change it to 'Home' then input the home number.

  • How do you add a stock tracker and weather to the notification center?

    How do you add a stock tracker and weather to the notification center?

    You can not. This is only a feature of iOS. It would only be supported via the dashboard on OS X

  • How do you add a Facebook, Twitter and Yelp links?

    How do you add links for Facebook, Twitter and Yelp onto a website created by using iWeb? I'm using a hosting service to get my site on the web.

    Hi 80smetalhead. My first help post, so hope it helps.
    First off choose wether you are using a icon or text.
    For a few free Facebook/twitter/in icons try: http://www.jordankennedy.com/jk/Free_Stuff.html
    Ether way the process is the same. Select the Text/iCon. Then go to "Inspector" in the bottom right hand. (Blue circle with a "i" in it)
    Then select the sixth iCon across. (blue circle with arrow)
    Click "Enable as Hyperlink"
    Then under that Link to: External Page <--this should be selected.. If not select it.
    Under that will be a box with a link already in there. usually a apple link. change that to your Facebook/Twitter address.
    And that hopefully should do the trick

  • How do you add a new buddy and have it save them?

    when i add a new buddy the person shows up under offline but i know that the person is online because she is texting me and then 2 minutes later the person dissapers and ichat doesn't work with the person. the person who i am trying to add to my list is doing the same thing but it's still not working, why?

    Hi
    It would help to know what type of Buddy they are (AIM, Jabber or Yahoo) ?
    It would also help to know which version of iChat you are using (Some (most) versions don't do Yahoo)?
    Then we need to know what Screen Name or ID you have ?
    This will tell us what sort of Buddy List you are trying to Add the person to.
    AIM Buddies (Included @mac.com and @me.com names) can be set to Invisible in some version of iChat in in some other apps if they are not using iChat.
    Also look in iChat menu > Preferences > Accounts > Security tab  for your AIM accounts
    There are variation as to who is allowed and who isn't allow to See you as On line.
    This can be complicated by the settings at the Buddies end.
    Jabber Buddy lists
    When you add a Buddy here it sends an "Authorisation Request" fro them to be a Buddy.
    They have to either Agree  or Decline.
    iChat sends this Request just once and if th Buddy does ot answer it they appear in the Off Line Section of your Buddy list (although they can text you and appear in Dark Text suggesting they are On line)
    Jabber (Includes Google Talk and Facebook) cannot be set to Invisible.
    It is best that you add the Buddy at an agreed time or use a third party app such as Psi that keeps sending Authorisation Requests until the person Accepts or Declines.
    7:40 PM      Thursday; August 9, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How can you add your own print and export buttons to the CR viewer toolbar?

    I posted a previous question that was asking how to get around the Information Bar in IE7 when you export and print.  Unfortunately the CR viewer file download code gets blocked by IE7 because the buttons don't directly download the file.  However, I have been able to get a regular button that calls the following code and streams the file to the client and IE7 does not block it. 
    Sub PrintPDF(sender As Object, e As System.EventArgs)
         Dim crReportDocument as ReportDocument
         Dim crExportOptions as ExportOptions
         Dim crDiskFileDestinationOptions as DiskFileDestinationOptions
         Dim Fname as string
         CrReportDocument = New ReportDocument()
         CrReportDocument.Load(Server.MapPath("estactionlist.rpt"))
         Fname = Server.MapPath("./") & Session.SessionID.ToString & ".pdf"
         CrDiskFileDestinationOptions = New DiskFileDestinationOptions()
         CrDiskFileDestinationOptions.DiskFileName = FName
         CrExportOptions = crReportDocument.ExportOptions
         With crExportOptions
              .DestinationOptions = CrDiskFileDestinationOptions
              .ExportDestinationType = ExportDestinationType.DiskFile
              .ExportFormatType = ExportFormatType.PortableDocFormat
         End With
         CrReportDocument.Export()
         Response.ClearContent()
         Response.ClearHeaders()
                    Response.AddHeader("content-disposition", "attachment;filename=test.pdf")
                    Response.ContentType = "application/pdf"
                    Response.Charset = ""
                    Response.WriteFile(Fname)
                    Response.Flush()
         Response.Close()
         System.IO.File.Delete(Fname)
    End Sub
    So here are my questions?
    1. Is it possible to add a custom print control/icon to the CR viewer toolbar?
    2. If one is not possible, then is it possible to override the CR viewer print and export buttons with your own subroutines like the one above?
    I just want my page to look nice and hate to have print and export buttons outside of my CR viewer. 
    Thanks,
    Kevin

    It might be possible to replace the buttons in a windows app since you can retrieve the toolbar as a toolbar object in the winform viewer  ( ToolStrip toolBar = (ToolStrip) crystalReportViewer1.Controls[3]; )  however with a web app, it's a lot more difficult.
    The problem is that that you need to parse the Request string to try and figure out if the print / export button was clicked.  The code below makes the print button disappear if you click it, so you should be able to modify it to call your custom printing / exporting code instead  (You have to do this check in a postback)
            Dim I As Integer = 0
            If Request.Form.AllKeys.Length > 0 Then
                For I = 0 To Request.Form.AllKeys.Length - 1
                    Response.Write(Request.Form.Keys(I).ToString & "<BR>")
                    If Request.Form.Keys(I).ToString = "CrystalReportViewer2:_ctl2:_ctl2.x" Then
                        CrystalReportViewer2.HasPrintButton = False
                    End If
                Next
           End If
    Shawn

  • How Do You Add an Autofill Username and Password

    Is there a way to manually add a username and password to the Autofill function?
    Most of the secure sites I navigate to have asked if I want to have Safari remember this information, and after that it appears. Autofill "user names and passwords" box is checked, and those sites appear on the list when I select "edit."
    One or two sites, however, do not result in the do-you-want-to-save dialog. Anybody know why? I there a way to manually add it to the list? I can't find it if there is.

    One or two sites, however, do not result in the do-you-want-to-save dialog. Anybody know why? I there a way to manually add it to the list? I can't find it if there is.
    A website can specify whether a browser should autofill a form field or not. For reasons of security, some websites (typically banks) turn off autofilling on purpose.

  • How do you add the absolute time and date to a spreadshee​t file?

    I am creating a spreadsheet file, and I want to write the absolute time and date to its first column. Does anybody know how to do this?
    Thank You,

    BrianL answer is still valid !
    Attached is an example file with an express vi configured to use the absolute time generated from a get time/date node.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Save with absolute time.vi ‏135 KB

  • How do you add additional fields in infotypes?i want to leave blank space

    how do you add additional fields in infotypes?i want to leave blank space in front of the field?

    Hi,
    To add new fields go to PM01 and select Enhance Infotype option and then follow the steps in sequence.
    I am not getting blank space in front of the field. please elaborate it.
    Regards,
    Raja.D

  • How do you add fields to your PDF using Adobe Acrobat

    how do you add fields to your PDF using Adobe Acrobat

    Hello Sara!
    Txs for your super quick reply.
    Yes, we do have the full version  for Adobe and when I am in tools and forms, what comes next?
    See attached picture of pdf…
    If you could help me with that, that would be great (the forums do not show any results…)
    Thanks, have a great day!
    Rilana
    [private information removed by moderator]
    P Please consider the environment before printing this email

  • How do you add an iTunes Gift Card & how is it charged?

    Hey all,
    I currently pay for my iTunes downloads direct from my Debit Card. If I add a gift card to my account will the cost of downloads come from that automatically or do I need to let iTunes know thats what I want?
    Also - how do you add the card? I'm probably being totally stupid but can't seem to find an "add credit here" option.
    Help appreciated

    If you redeem an iTunes gift card, the next purchases you make up to the value of the gift card will be made from it automatically. To add the card, click here; this link will open iTunes.
    (34512)

  • How do you add multiple iTunes to Keynote

    How do you add multiple songs from the iTunes to your Keynote presentation?

    Jer&Renee,
    welcome to Apple Discussions.
    It depends where you want them in your presentation.
    Open the Media inspector and choose a playlist. In the list of entries, mark those you want to add to Keynote (use command-click to mark multiple titles not in one block).
    Then drag the marked titles either on a slide or on the small Audio field (looks like a frame) in Document inspector. When you then hover the cursor at the Audio "frame", you'll see the quick info "Multiple Files". You cannot change the order or remove one of the files, but only all of them.

  • How do you add a custom label to dates in contacts.....

    How do you add a custom label to dates in contacts- I have multiple birthdays in contact group and want to change label through customise to add additional birthday- unless another way to add second birthday to contacts and identify each one?????? or way to link contacts with same address phone number etc but id birthdays?????

    You have some contacts with more than one birthday?
    To add a custom label for a date, select Edit for an existing contact. Select Add Field. Select Date. Scroll up with the Info window above the date selection and select Other for the new date selection. Select Add Custom Label and then select this label for the new date field for the contact.
    As far as linking dates with multiple contacts, the answer is no to that.

  • How do you add more memory to a macbook circa 2007

    how do you add memory to a macbook mid-2007?

    >If you have a Mid 2007 MacBook, that can use up to 3GB RAM.
    Since that model can use an odd number RAM capacity upgrade, with
    a total of 3GB between two memory slot locations, you could put one
    piece of RAM of 1-GB in a slot, and in the other, a 2-GB RAM chip...
    Maximum Memory:    3.0 GB (Actual) 2.0 GB (Apple)
    Memory Slots:    2 - 200-pin PC2-5300 (667MHz) DDR2 SO-DIMM
    •MacBook: How to remove or install memory
    >If you have a Late 2007 MacBook, that can use up to 6GB RAM:
    Maximum Memory:    6.0 GB (Actual) 4.0 GB (Apple)
    Memory Slots:    2 - 200-pin PC2-5300 (667MHz) DDR2 SO-DIMM
    Recommendations have been to check the spec and model computer
    against the on-site parts suggestions for the computer model identifier
    at OWC macsales.com, or check into Crucial.com for specific match
    based on their information. OWC tends to be an easier way if you know
    the MacBook model identifier, and if yours actually is the Mid-2007 vs
    another different one. The Late-2007 can use up to 6GB RAM.
    •The identifiers for Mid-2007 MacBook 13-inch:
    Introduced    May 2007
    Discontinued    November 2007
    Model Identifier    MacBook2,1
    Model Number    A1181
    EMC    2139
    Order Number    MB061LL/A (White), MB062LL/A (White), MB063LL/A (Black)
    •The identifiers for Late-2007 MacBook 13-inch:
    Introduced    November 2007
    Discontinued    February 2008
    Model Identifier    MacBook3,1
    Model Number    A1181
    EMC    2200
    Order Number    MB061LL/B (White), MB062LL/B (White), MB063LL/B (Black)
    {as you may notice, some identification numbers are recycled; for confusion sake}
    Hopefully this helps somewhat.
    Good luck & happy computing!
    edited

  • How do you spell check a field?

    How are people spell checking their fields?
    In searching around, I have only found (a) suggestions to yank the text into MS Word, do a spell check, then yank the resulting text into the field; (b) software from DC AL CODA that we aren't clear how they actually work (http://www.dcalcoda.com).
    Specifically, my manager wants a tool that'll interface with Oracle like this: give a table name and a field name and be asked about each spelling error, much like an email spell check. The tool would change things as you ask, directly in the database. You wouldn't have to cut and paste into it and back to the db fields.
    We aren't using forms. We use SQL*Plus, Quest Software's TOAD, and our own Java servlets (using JDBC to enter SQL statements).
    I would love to hear how people do their spell checking.
    Hopefully this is an appropriate forum for this question. There doesn't seem to be a general or SQL forum. Our database tables include a fair amount of text that shows up on Web pages. These are the fields we want to spell check.

    I thought I'd reply to my own question since I found a workable solution, at least for our office which has MS Windows.
    MS Access can connect directly to an Oracle data source. Access has a spell checking feature where you can select a field and spell check it. Below are tips and instructions for doing this.
    TIPS:
    It's surely a good idea to back up tables and be the only person or process changing those tables during the spell check.
    One thing to watch for is whether the entire table comes in. At the bottom of the screen is a >* button which seems to get all fields. For large tables, you have to hit this button before you get the entire table.
    Another glitch is that all of the given database user's tables show up in one list box -- makes for some painful scrolling, but all of the tables are listed.
    A much smaller glitch is that if you widened any of the fields in the view of the table, when you close the window, it asks if you want to save the formatting. It has nothing to do with saving the data (that is automatic). It's safe to say no.
    The spell check doesn't recognize HTML tags (asks about "br"s from <br> tags) but seems to know to ignore things like &quot;
    How to set up an ODBC Data Source in Windows:
    1. MS Start -> Settings -> Control Panel -> ODBC Data Sources (32 bit)
    2. Drivers tab, scroll down and select Oracle ODBC Driver
    3. OK
    4. User DSN tab, Add...
    5. Select Oracle ODBC Driver and Finish
    6. Make up a data source name (example: src)
    7. Enter a description for it
    8. For Service name, put what your service name is (for an SQL*Plus connection, 'usr/passwd@svc', this is 'svc')
    9. For UserID, put your user id (for an SQL*Plus connection, 'usr/passwd@svc', this is 'usr')
    10. Ignore the rest of the fields, click OK
    11. Another OK.
    How to use Access to Spell Check an ODBC Data Source Field:
    0. Install Access from (MS Office 2000).
    1. Start Access (by the way, you might find it way down the list in Start -> Programs).
    2. Open file, in the file type box, scroll to the end: ODBC Databases. You'll get a dialog.
    3. Machine Data Source tab, select the name you gave it (src in step 6 above)
    4. You'll be prompted for the password (for an SQL*Plus connection, 'usr/passwd@svc', this is 'passwd')
    5. Select from the huge list of every table the table you want. Ok.
    5.a. If the table has no key, you'll be prompted for the unique key from a list of all fields.
    6. Double click the item that has just been added to the dialog that remains on the screen. It'll have a globe next to text like USR_TABLENAME. This brings up a randomly sized first chunk of the table.
    7. To make sure you get the entire table, on the paging buttons on the bottom (|< < > >| >*), click >*. It may take a few moments to get a huge table.
    8. Click the heading of the field (column) you want to spell check). This selects the entire column.
    9. Hit spell check (ABC checkmark tool or Tools -> Spelling)
    10. Check away. The changes are made immediately to the database.
    11. Close the table display window.
    null

Maybe you are looking for