help in writing a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • creative1
    Contributor
    • Sep 2007
    • 274

    help in writing a query

    hi,
    I am struck in writing a query; here is scenerio:

    Following tables are involved:

    product_codes(i tem_code,descri ption, unit_price,unit _size,PAY_GST...)
    Vendor(account_ no,Name,address ,GST_NO,PST_NO....)
    Inv_total (tran_id, total_amt,GST,pst,.......)
    inv_detail(sr_n o, tran_id, item_code,unit_ price,qty....)

    I want to generate daily closing summary report where I calculate total of all transections for a particular day: like this

    GRP NAME AMOUNT PAID GST PST TOTAL
    METALS
    NON-METALS
    PAPERS
    UBC

    Now the problem to calculate total GST and PST paid group wise.

    I'll only talk about GST.
    I want to calculate GST paid on all groups. The problem is GST is stored in inv_total and is summed up for all the products in a particular invoice.
    GST is not paid on all items
    GST is paid only on those items where
    Product_codes.P AY_GST=TRUE and Vendor.PST_no<> NULL

    Here is what I am looking for:
    I want to sum up total of all groups(metals etc) and also total GST paid on against them.

    I don't know if you guys understand my problem. Please please help me get the logic for it. IF you need more description or don't understand it, I can rephrase the issue.

    Thanks in advance
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    A representation of the data in the tables and the data as you want it returned will help us to understand your scenerio more fully.
    If you could post that, someone will provide a solution

    You may even find as you assemble the table data and result data to post here, that an answer will come to you. I often have that occur for me.

    Comment

    • creative1
      Contributor
      • Sep 2007
      • 274

      #3
      Originally posted by Delerna
      A representation of the data in the tables and the data as you want it returned will help us to understand your scenerio more fully.
      If you could post that, someone will provide a solution

      You may even find as you assemble the table data and result data to post here, that an answer will come to you. I often have that occur for me.
      What exactly I should do?

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        Originally posted by creative1
        What exactly I should do?
        You should post the tables metadata.
        Here is an example of how to post table MetaData :
        Table Name=tblStudent
        Code:
        [i]Field; Type; IndexInfo[/i]
        StudentID; AutoNumber; PK
        Family; String; FK
        Name; String
        University; String; FK
        Mark; Numeric
        LastAttendance; Date/Time

        Comment

        • Delerna
          Recognized Expert Top Contributor
          • Jan 2008
          • 1134

          #5
          What exactly I should do?
          like the first post and subsequent posts here or here

          Comment

          Working...