pgsql選択クエリでコンマをアポストロフィ/一重引用符に置き換えるにはどうすればよいですか? 私の現在のクエリは次のとおりです。
SELECT array_to_string(array_agg(districtname), ', ') as dnames
FROM districts
where id in ('' || Replace((select districtIds from tblmtr where id = 1), ',' , ''',''') || '');
nullを返しています。
テーブル内の IDは次のtblmtrようになります2, 3,4
2only or 3orに変更すると4、正しい結果が返されます。
結果は次のようになります。district1name,district2name,district3name