Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    100

    Unanswered: Grid Query Question

    I'm trying to build this query using the query grid and seem to be having trouble getting the records to condense into a single row:


    Before:
    teClient.........ProjectId..........Hours...Rate.. ..Billed....DiscAmt
    Migration.Co....JJJJ-5N6NQF.....5.......105.......525.......5000
    Migration.Co....JJJJ-5N6NQF.....10......105.......1050......5000
    Migration.Co....JJJJ-5N6NQF.....10......105.......1050......5000
    Media.Co........JJJJ-5QJ6WG.....1.......150.......150.......2500
    Media.Co........JJJJ-5QJ6WG.....1.......150.......150.......2500
    Media.Co........JJJJ-5QJ6WG.....1.......150.......150.......2500


    After:
    teClient.........ProjectId...........Hours...Rate. ...Billed....DiscAmt
    Migration.Co....JJJJ-5N6NQF.....25......105.....2625........5000
    Media.Co........JJJJ-5QJ6WG.....3.......150.....450.........2500

    (note: "Billed" and "Hours" field are summed)



    Thanks for your help!

    Norm

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Grid Query Question

    Originally posted by norm801
    I'm trying to build this query using the query grid and seem to be having trouble getting the records to condense into a single row:


    Before:
    teClient.........ProjectId..........Hours...Rate.. ..Billed....DiscAmt
    Migration.Co....JJJJ-5N6NQF.....5.......105.......525.......5000
    Migration.Co....JJJJ-5N6NQF.....10......105.......1050......5000
    Migration.Co....JJJJ-5N6NQF.....10......105.......1050......5000
    Media.Co........JJJJ-5QJ6WG.....1.......150.......150.......2500
    Media.Co........JJJJ-5QJ6WG.....1.......150.......150.......2500
    Media.Co........JJJJ-5QJ6WG.....1.......150.......150.......2500


    After:
    teClient.........ProjectId...........Hours...Rate. ...Billed....DiscAmt
    Migration.Co....JJJJ-5N6NQF.....25......105.....2625........5000
    Media.Co........JJJJ-5QJ6WG.....3.......150.....450.........2500

    (note: "Billed" and "Hours" field are summed)



    Thanks for your help!

    Norm
    SELECT teClient, ProjectId, Sum(Hours) AS Expr1, Rate, Sum(Billed) AS Expr2, DiscAmt FROM MyTable GROUP BY teClient, ProjectId, Rate, DiscAmt;

    And the problem is?

Posting Permissions

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