I am trying to tally up player appearances from two tables that contain sport game data.
Here are the columns:
Table 1: home_team
game_ID home, home_team, player1, player 2, player 3, player4
Table 2:visiting_team
game_ID home, home_team, player1, player 2, player 3, player4
The names under player1, player2 etc can be the same as a player in different games can play different positions.
I would like to find the unique player names in the two tables for each teams and figure out how many times they played and list it out like
Team A, name_of_player1, #apperances,
name_of_player2, #apperances, etc
How would I do it?
4 1479 You have two options here but the correct one is to create a new table that stores players. Then you create report based on this table --> add another field and use the DCount function inside it (example - =DCount("PlayerOneFieldName","HomeTeamTable","[PlayerOneFieldName] = '" _
-
& Reports!ReportName!Player& "'")
If the same player moves from field to another (today is player 1, tomorrow player 2 and so on), you have to get the total of Counting all Fields where this player has played. Then it becomes like - NZ(DCount("PlayerOneFieldName","HomeTeamTable","[PlayerOneFieldName] = '" _
-
& Reports!ReportName!Player& "'"),0) + NZ(DCount("PlayerTwoFieldName","HomeTeamTable","[PlayerTwoFieldName] = '" _
-
& Reports!ReportName!Player& "'"),0) + ....
.
The NZ will avoid errors if there are no records for this player.
Note that you better use this in the query of the report itself.
Hope this helps,
Regards,
Ali
Thanks for the solutions! How would I create a new table that extracts the unique player names?
Just create a new table (name it PlayerTbl for example) and insert a new field (PlayerName).
Regards,
Ali
Did you work it out?
Regards,
Ali
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ori |
last post by:
Hi,
I have two tables such that in each table I need to make sure that
column x in table A and column y in table B have a unique values
meaning that a user cannot insert a value to column A if...
|
by: web1110 |
last post by:
Hi y'all,
I was playing with the NorthWind database, displaying subtables in a
DataGrid. It worked fine for 3 levels, but when I added a fourth, I got the
following error:
These columns...
|
by: Benjamin Smith |
last post by:
I have two tables like following:
create table attendancereport (
id serial unique not null,
staff_id integer not null references staff(id),
schoolyear varchar not null references...
|
by: nescio |
last post by:
hello,
i have an array and i don't know the content of it, but i want only unique
values.
in php there is a function to do this, but how must i do this in javascript?
i have tried a lot and...
|
by: sqlservernewbie |
last post by:
Hi Everyone,
Here is a theoretical, and definition question for you.
In databases, we have:
Relation
a table with columns and rows
|
by: yasmine |
last post by:
Hi friends,
Can anyone tell me how can i write a php script which extract all the unique values of a field from multiple tables?
and also if anybody enters some new values it also should be...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |