php - How can I repeat a result row in SQLite? -
i'm sending query db:
select id,text mytable id in (2,3,4,4,5)
i want rows multi time, returns 1 time. example, want "row 4" multi time, when send query:
select id,text mytable id in (1,4,4,4,4,4,5)
it returns row 4 1 time.
i know can that:
select id,text mytable id=1 union select id,text mytable id=4 union select id,text mytable id=4 union select id,text mytable id=4 union select id,text mytable id=4 union select id,text mytable id=4 union select id,text mytable id=5
it's working, sends many "select" request database, i'm looking fastest way. better way exist? wich way better & faster? know can outside of sql using arrays, i'm looking sql query way.
i'm looking result:
id text 1 test 4 testt 4 testt 4 testt 4 testt 4 testt 5 testtt
the in operator checks whether value on left matches value on right. return multiple rows, have either use multiple selects, or create temporary table value 4
appears in multiple rows:
with ids_to_search(id) ( values (2), (3), (4), (4), (5) ) select id, text mytable join ids_to_search using (id);
Comments
Post a Comment