Results 1 to 4 of 4

Thread: Group and Sorting - Group Names

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Miami, Florida
    Posts
    161

    Question Group and Sorting - Group Names

    I created query to Sort by Room, Points, and finally Name. I would like to group by Name without affecting the Room and Point sorting and be able to group the names. How can I accomplish this?

    Sample Data

    Sorted By Room, Point, Name

    Name...............................Room....Point
    Eddie Van Halen.................51x50....20
    Robert Johnson..................30x20....30
    Joe Satriani.......................20x50....11
    Yngwie Malmsteen..............20x25....12
    Steve Vai......................... 10x20....19
    Eddie Van Halen.................10x10.....20

    Would like to sort by size, points, and name but somehow group by name if the person is in the listing more than once. In the listing below by sorting by size points, and name the line number 2 would be last entry.

    Desired Result
    1. Eddie Van Halen.................51x50....20
    2. Eddie Van Halen.................10x10.....20
    3. Robert Johnson..................30x20....30
    4. Joe Satriani........................20x50....11
    5. Yngwie Malmsteen...............20x25....12
    6. Steve Vai..........................10x20....19

    Your help would be greatly appreciated.

    Here's the SQL code:

    Code:
    SELECT TBLGuitarist.Rid, TBLGuitarist.lname, TBLGuitarist.fname, TBLGuitarist.point, First(TBLRoom.Size) AS [Size], First(TBLMfg.MFG) AS MFG, 
    FROM ((TBLRoom INNER JOIN TBLGuitarist ON TBLRoom.Rid = TBLGuitarist.Rid) INNER JOIN TBLProfile ON (TBLGuitarist.Rid = exTBLProfile.Rid) AND (TBLRoom.locid = exTBLProfile.locid)) INNER JOIN TBLMfg ON exTBLProfile.lines = exTBLMfg.MFG
    GROUP BY TBLGuitarist.lname, TBLGuitarist.fname, TBLGuitarist.Rid, TBLGuitarist.point, TBLRoom.category, TBLGuitarist.currshow
    HAVING (((TBLGuitarist.currshow)=True))
    ORDER BY TBLGuitarist.point DESC , First(TBLRoom.Size) DESC;
    Last edited by root2; Apr 17th, 2007 at 10:52 PM.

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