Dark
Dark

Reputation: 124

Multiple selection of ID's (MySQL)

Is it possible for me to select multiple ID? For example: I am executing this command

SELECT 
sum(amount)
FROM 
bets_logs
where
fight_id=1

Assumming that I have id that is up to 500 Of course I'll do it one by one... My target is, is there a query that I can select id from 1 to 10. So that I won't do it 1 by one.

Upvotes: 0

Views: 30

Answers (1)

PSK
PSK

Reputation: 17943

My target is, is there a query that I can select id from 1 to 10. So that I won't do it 1 by one.

You can write the query like following.

SELECT fight_id,  sum(amount) 
FROM 
bets_logs
where
fight_id >=1 and fight_id<=10
group by fight_id

Upvotes: 1

Related Questions