Results 1 to 2 of 2

Thread: Need help building an SQL statement

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75
    I am creating a Report using a Data Envirnoment and the Data Report Control. SO far I have eveything working as I want it but I am unable to import some important data I need.

    I am reading from an Access database with 2 tables (not linked) The second table contains some calculation information I need to apply to the 1st table (only 1 record with 3 fields)

    I am unable to JOIN the tables as there is no link between them....I was just wondering how I would get the information from the second table into the SQL to use in my data report.

    Hes the SQL statement I have now:

    SHAPE {SELECT * ,(Quantity*C3) AS C3Total, (Quantity*C4) AS C4Total,((Quantity*C3) + (Quantity*C4)) AS totalCurrent FROM Parts WHERE Quantity > 0} AS Command1 COMPUTE Command1, SUM(Command1.'C3') AS C3_Total, SUM(Command1.'Quantity') AS Quantity_Total, SUM(Command1.'C4') AS C4_Total, SUM(Command1.'C3Total') AS GroupTotalC3, SUM(Command1.'C4Total') AS GroupTotalC4, SUM(Command1.'totalCurrent') AS TotalCurrentC3C4 BY 'Category'


    I have a lot of summing going on
    C3 and C4 are current values (in amps)..ie 0.023

    What I need to do is:
    1) Multiply GroupTotalC3 by a number from field 1 in the 2nd Table of the DB
    2) Multiply GroupTotalC4 by a number from field 2 in the 2nd Table of the DB
    3) Add 1+2 above
    4) Take 3 and multiply by field 3 in the 2nd table of the DB


    All the information in the SQL statement is from table 1 of the DB...I need to get the 3 fields of information in Table 2 incorporated into the SQL statement somehow.

    Anyone have any ideas? Thanks

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Location
    Malaysia
    Posts
    69
    Sorry.. my post will not answer your question. But I want to ask how you get the Data Report Control in VB6 Components... I can't seem to find them in mine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width