merge rows of data within a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hrgilley
    New Member
    • May 2007
    • 2

    merge rows of data within a table

    I hope someone here can help me. I am trying to merge rows of data within a table. Here's what I have

    Guest id: Row: Section: Seat:
    567 A CC 102
    567 A CC 103
    567 A CC 104

    What I need to get is one row that says:

    Guestid: Seats:
    567 ACC102 - 104

    Can anyone help me?
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by hrgilley
    I hope someone here can help me. I am trying to merge rows of data within a table. Here's what I have

    Guest id: Row: Section: Seat:
    567 A CC 102
    567 A CC 103
    567 A CC 104

    What I need to get is one row that says:

    Guestid: Seats:
    567 ACC102 - 104

    Can anyone help me?
    [code=sql]
    SELECT Guest_ID, Row, Section, MIN(Seat) AS First, MAX(Seat) AS Last FROM Table GROUP BY Guest_ID. Row, Section
    [/code]
    Last edited by Motoma; Jun 1 '07, 07:16 PM. Reason: Please use [CODE] tags Please!

    Comment

    • hrgilley
      New Member
      • May 2007
      • 2

      #3
      Thanks! I'll try that!

      Comment

      Working...