V
V
Vitaly Kostyuk2018-04-22 19:13:02
SQL
Vitaly Kostyuk, 2018-04-22 19:13:02

Get a list of athletes who play multiple sports?

Hello, sorry for such a simple task, but I'm stuck.
I have a table Sports, and there is a table Athlete, I created an intermediate table Athlete Sports. In the query you need:
Get a list of athletes who play several sports, specifying them
I did this:
WHERE [Sport] IN ('Hockey ','Basketball')
but I got a list of athletes involved in at least one of these sports. And I need only athletes who are involved in both sports

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey Tsvetkov, 2018-04-22
@PrOsTa4oK

make a query against your intermediate table, something like this:

SELECT 
  id_sportsmen 
FROM 
  your_table 
GROUP BY
  id_sportsmen 
HAVING 
  count(*) > 1

Get your desired list

S
Sergey Sokolov, 2019-10-12
@zeroser79

Sports store http://sportuno.com.ua

S
sanyashufter, 2020-07-23
@sanyashufter

First you need to choose the people you want to see on your site. It definitely has to be someone famous. I would choose athletes according to the rating of the bookmaker Leon here is a list of the best.

A
andrejostap80, 2020-09-25
@andrejostap80

it is better to implement it the way it is done on the Leon page with a promo - more

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question