mysql - Displaying Results Ending in a Certain Value I.E. 1 With The RIGHT Keyword -


just wondering how can display data ends in value right keyword. have been using following query not getting expected result. issue having getting figures ending in values higher on (see below output query).

in nutshell need output contains results ending in 1 horse_id , event_id.

query

select *      entry     right(event_id , horse_id, 1); 

table structure

+----------+--------+------+-----+---------+-------+ | field    | type   | null | key | default | | +----------+--------+------+-----+---------+-------+ | event_id | int(3) | yes  | mul | null    |       | | horse_id | int(2) | yes  | mul | null    |       | | place    | int(1) | yes  |     | null    |       | +----------+--------+------+-----+---------+-------+ 

actual result

+----------+----------+-------+ | event_id | horse_id | place | +----------+----------+-------+ |      101 |      101 |     1 | |      101 |      102 |     2 | |      101 |      201 |     3 | |      101 |      301 |     4 | |      102 |      201 |     2 | |      103 |      201 |     3 | |      201 |      101 |     1 | |      301 |      301 |     2 | |      401 |      102 |     7 | +----------+----------+-------+ 

expected result

+----------+----------+-------+ | event_id | horse_id | place | +----------+----------+-------+ |      101 |      101 |     1 | |      101 |      201 |     3 | |      101 |      301 |     4 | |      201 |      101 |     1 | |      301 |      301 |     2 | +----------+----------+-------+ 

thanks in advance on one. can't seem find documentation on right keyword in mysql docs.

stu :)


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -