Hello, I have such a situation, I need to add another sample from another table (statisticsTable) to the main sample in the players table. The bottom line is that the player has a lot of statistics for each game, and I need to display additional columns in sums over several fields. like that
select sum(StatisticsTable.Falls) as 'Фолов за всю жизнь' from StatisticsTable, Players where (Players.PlayerID = StatisticsTable.PlayerID) the query for the first table itself looks like this
select Players.FirstName as 'Имя', Countries.NationalityName as 'Национальность', Teams.TeamName as 'Команда', Positions.PositionName as 'Позиция', datepart(year,getdate())-datepart(year, Convert(Varchar, DateOfBurn, 104)) as 'Возраст' from Players, Countries, Positions, Teams where ((Players.CountryID = Countries.CountryID) and (Players.TeamID = Teams.TeamID) and (Players.PositionID = Positions.PositionID)) But simply putting UNION between these queries results in the error "Message 205, level 16, All requests combined with the UNION , INTERSECT or EXCEPT operators must have the same number of expressions in the target lists." Please help me correctly combine these 2 samples
datediff(year, DateOfBurn, getdate())- Mikedatepart(year,getdate())-1997, in the second, what I wrote above will work fine - Mike