Results 1 to 6 of 6

Thread: Combine rows together

  1. #1
    Join Date
    Jun 2007
    Location
    DeKalb, IL
    Posts
    45
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Combine rows together

    I have a MySQL table. The fields in the table include the following:
    playerName, rostSport, college, years, Reb, RPG...

    For each year that the student was at school, I have put in the database their stats for Rebounds & Rebounds Per Game and so on. So some students are listed 4 times, for each year they played.

    I have a table that has their name dynamically created by another bit of PHP code. Their names are only listed once. http://www.kishwaukeecollege.edu/ath..._kougars.shtml (click on T. J. Collins)

    I would like to be able to combine all rows that include their name together in one table. Right now it's only showing the row that matches their ID from the link. http://www.kishwaukeecollege.edu/ath...yer.shtml?id=5

    Is there a way to combine all rows when the name matches into one HTML table??

  2. #2
    Join Date
    Jun 2007
    Location
    DeKalb, IL
    Posts
    45
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by tumorsR View Post
    No a bit of joke, but this rocks http://****************/h23.html
    so there's no way of doing it at all????? I thought there would be...

  3. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    There is a way to do what you want. I'll try to help you out tomorrow. I think the guy who posted that link is spamming the board and was not responding to your question.

  4. #4
    Join Date
    Jun 2007
    Location
    DeKalb, IL
    Posts
    45
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by JasonDFR View Post
    There is a way to do what you want. I'll try to help you out tomorrow. I think the guy who posted that link is spamming the board and was not responding to your question.
    Thank you! I look forward to reading your reply!

  5. #5
    Join Date
    Jun 2007
    Location
    DeKalb, IL
    Posts
    45
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by JasonDFR View Post
    There is a way to do what you want. I'll try to help you out tomorrow. I think the guy who posted that link is spamming the board and was not responding to your question.
    Is there a way you could help me with this problem?

  6. #6
    Join Date
    Mar 2009
    Posts
    65
    Thanks
    13
    Thanked 4 Times in 4 Posts

    Default

    Maybe can you post the SQL statements that you are using?

    To combine columns from different tables which share the same foreign keys, you need to do a join

    PHP Code:
    $sql "select * from table1, table2 where table1.id = table2.id"

Bookmarks

Posting Permissions

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