sql - Select row for every key in IN statement even if they are equal -


example question follow:
i've got array of id's

[ 6230, 206, 4259, 24761, 26736, 219, 281, 281, 516, 495, 10371 ] 

and want setup select query database.table that:

select * `database`.`table` `id` in (6230, 206, 4259, 24761, 26736, 219, 281, 281, 516, 495, 10371); 

as can see i've got 2 id equal in result of query i'll got 10 rows.
want 1 row every id in array. guesseing not posible "in()" statement.
can assumption's on how solve proplem.
just notice: can't perform different query every element of array.

create set 1 record each id, , join on that:

select t.* database.table t inner join (   select 6230 id union   select 206 union   select 4259 union   select 24761 union   select 26736 union   select 219 union   select 281 union   select 281 union   select 516 union   select 495 union   select 10371 ) x on x.id = t.id 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -