Need help in creating a SQL query using a view Topic is solved

Relax and enjoy The Lounge. For all Non-Joomla! topics or ones that don't fit anywhere else. Normal forum rules apply.
Post Reply
XavierD
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Jun 29, 2022 6:23 am

Need help in creating a SQL query using a view

Post by XavierD » Sat Sep 24, 2022 9:53 am

I have a table that stores a rundown of Game IDs, the Client IDs of clients that played that game, and the Score that every client accomplished in the game.

I'm attempting to compose a SQL inquiry to make a perspective on this information that would let me know the number of games every client has won, drawn, and lost in view of the score.

I'm attempting to think of the syntax to make a view that changes the information along these lines, yet am experiencing difficulty. Here is the article I was reading before trying this stuff https://www.scaler.com/topics/views-in-sql/. But was not able to understand the concept in a good manner. Can someone help me with this?
Last edited by toivo on Sat Sep 24, 2022 11:01 am, edited 2 times in total.
Reason: mod note: retitled - please read the forum rules about appropriate subject line from https://forum.joomla.org/viewtopic.php?f=8&t=65

gws
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4874
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Need Help!!

Post by gws » Sat Sep 24, 2022 9:59 am


User avatar
ceford
Joomla! Ace
Joomla! Ace
Posts: 1358
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Need help in creating a SQL query using a view

Post by ceford » Thu Sep 29, 2022 5:29 pm

I don't know enough about views! So I would approach the problem with subqueries: count the number of wins, draws and losses separately, concat the scores on each game for each client into a list (10, 12, 15, ...), maybe another to average those scores ... using table joins for clients, games and scores.


Post Reply

Return to “The Lounge”