mysql - Sub Queries and fetching data from two tables -


i need list horse_id, horse_name each horse has placed in top 3 (e.g place 1,2 or 3) two or more times. hint: try using where...in...

i'm pretty sure i'll have data horse table, includes horse_id , horse_name, , data prize table, includes column place (place horse was). place table has columns event_id, place , money, i'm not sure how join horse table.

it's hard make out tables , data since posted in comments instead of question, try this.

select horse.*    horse     inner join entry       on horse.horse_id = entry.horse_id   entry.place <= 3   group horse.horse_id   having count(horse.horse_id) >= 2 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -