How to translate PostgreSQL array_agg function to SQLite?

This query works in PostgreSQL:

Select ot.MCode,array_to_string(array_agg(tk1.TName || ',' || ot.TTime), ' - ') as oujyu_name_list From TR_A ot inner join MS_B tk1 on ot.Code = tk1.Code Where ot.Code in (Select Code From TR_C ) Group byot.MCode 

but it does not work in SQLite, because SQLite does not have an array_agg() function. How can this query be converted to SQLite?

+5
source share
1 answer

For this request, you can use group_concat , which directly returns a string:

 SELECT ..., group_concat(tk1.TName || ',' || ot.TTime, ' - ') FROM ... 
+5
source

Source: https://habr.com/ru/post/1206850/


All Articles