Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    311

    Unanswered: Union and sub qrys

    I have a BUNCH of tables with the same type of data & structure
    In all off these tables are inv# inv$ and ck number,


    How can i do a sub qry or union that will group by ck Num and sum on inv$? those are the only 2 col of info i want



    HELPPPPPPPPPPPPPP!!!!!!!

  2. #2
    Join Date
    Oct 2003
    Posts
    311

    Angry

    and !!!! what table the sum is from

  3. #3
    Join Date
    Oct 2003
    Posts
    311
    Originally posted by mikezcg
    and !!!! what table the sum is from

    Got it !!!


    SELECT CheckNum, sum(NetCharge) as "Total", "aFedex090503" as "Table" FROM aFedex090503 group by checknum,"Table"
    UNION SELECt CheckNum, sum(NetCharge)as "Total", "aFedex090503a" as "Table" From aFedex090503a group by checknum,"Table"
    UNION SELECt CheckNum , sum(NetCharge)as "Total", "aFedex090503b" as "Table" From aFedex090503b group by checknum,"Table"
    UNION SELECt CheckNum , sum(NetCharge)as "Total", "aFedex091003" as "Table" From aFedex091003 group by checknum,"Table"
    UNION SELECt CheckNum, sum(NetCharge) as "Total", "aFedex091003a" as "Table" From aFedex091003a group by checknum,"Table"
    UNION SELECt CheckNum, sum(NetCharge) as "Total", "aFedex091603a" as "Table" From aFedex091603a group by checknum, "Table"
    UNION SELECt CheckNum, sum(NetCharge) as "Total" , "aFedex092303" as "Table" From aFedex092303 group by checknum,"Table"
    UNION SELECt CheckNum, sum(NetCharge) as "Total", "aFedex100103 " as "Table" From aFedex100103 group by checknum,"Table"
    UNION SELECt CheckNum, sum(NetCharge) as "Total", "aFedex100803" as "Table" From aFedex100803 group by checknum,"Table"
    UNION SELECt CheckNum, sum(NetCharge) as "Total", "aFedex101403" as "Table" From aFedex101403 group by checknum,"Table"
    UNION SELECt CheckNum, sum(NetCharge) as "Total", "aFedex102103" as "Table" From aFedex102103 group by checknum,"Table"

Posting Permissions

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