Results 1 to 7 of 7

Thread: Grouping

  1. #1
    Join Date
    Jan 2004
    Posts
    12

    Question Unanswered: Grouping

    I'm trying to write a report and need to group columns that are alike.
    For example.

    DeptID JobTitle

    40344 Sales Clerk
    1st Assistant
    Store Manager

    40666 Sales Clerk
    2nd Assistant
    Store Manager


    Sorry, it will not output correctly, I hope you get what I'm trying to do.
    I can get the results above but it puts the deptid for each job title. I do not want it. Any help will be appreciated. Thanks in advance.
    Last edited by goreejm; 06-22-04 at 21:56. Reason: The output wasn't expected

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Why? This is just a display issue. Can't you handle it in the frontend?
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    Jan 2004
    Posts
    12

    grouping

    Not if its just a query. I was thinking about doing the whole cursor deal and looping through that to give me my desired results but i thought it would be an easier way.

  4. #4
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    You could do it as two selects. Select into a table variable with an identity column. Then select from the table variable and show blank if it's not the max(identity) for the given DeptID. Make sense?
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  5. #5
    Join Date
    Jan 2004
    Posts
    12
    Yes, thank you.

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    What about appending a carriage return to the last field: + char(13)?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by blindman
    What about appending a carriage return to the last field: + char(13)?
    If you pursue that route, you need to "crelf it"... Instead of just a carriage return, you need a carriage return followed by a line feed which is: + Char(13) + Char(10)

    -PatP

Posting Permissions

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