Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7497605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:09:27+00:00 2026-05-29T19:09:27+00:00

I need some help I have been scouring the web and haven’t been able

  • 0

I need some help I have been scouring the web and haven’t been able to find something too similar. I have a MYSQL database for my Golf League. I need to display standings by creating a view from this database. There are 2 people per team, my primary key in ‘players’ is ‘id’ there is also a teamID (numerical value 1 – 20, 20 teams) for each player which corresponds to their teammates. Basically what I need is a view that contains ‘teamID’, both players ‘LName’ (maybe an ‘LNameA’,’LNameB’), and a sum of the two players ‘points’ field. I have never summed a field from one person and another or created a view in MYSQL.

EDIT:

I was trying something like

CREATE 
VIEW standings1
AS SELECT teamID, LName, points
FROM players

but need teamID to be the primaryKey of the view which will contain each players last name, and their points summed together.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:09:29+00:00Added an answer on May 29, 2026 at 7:09 pm

    Try this:

    create view standings as
      select teamId, group_concat(lname separator ', ') as TeamMembers,
        sum(points) TotalPoints from players
      group by teamId
    

    Oh, one more thing. If you want to have the names of the players in different fields (group_concat just separate them by commas, but it is still a single field) you can use this query:

    create view standings as
      select a.teamId, a.lname as player1, b.lname as player2,
      a.points + b.points TotalPoints
      from players a
      join players b ON a.teamId = b.teamId AND a.id >= b.id
      group by a.teamId, a.id
      having count(*) = 2
    

    That way you can play better with the names in PHP without having to parse the “, “

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help, i have been searching around and cant find the correct
I need some help. I have been searching for days trying to find solution
I need some help with a work project I have been assigned. At the
I really need some help with this as I have been trying to fix
I have been having some issues with django-haystack and need some help. I run
I need some help with some CSS coding. I have been trying to get
I have a query I need some help with, have been checking out a
Need some help about with Memcache. I have created a class and want to
Need some help to solve this. I have a gridview and inside the gridview
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.