'2019/10/15'에 해당되는 글 3건

  1. 2019.10.15 sql 결과 공백 제거
  2. 2019.10.15 postgres 배열 처리하기
  3. 2019.10.15 adex 2019 2

trim() 으로 하면 끝

옵션은 많지만 일단 앞뒤로 알아서 잘라주는 듯?

 

[링크 : https://araikuma.tistory.com/523]

[링크 : https://www.postgresql.org/docs/9.4/functions-string.html]

[링크 : http://www.postgresqltutorial.com/postgresql-trim-function/]

Posted by 구차니

일단 쿼리는 아래처럼

SELECT (refid::bigint[])[array_length(refid::bigint[], 1)], refid::bigint[] FROM array_table
where rowid = 8;

 

해당 필드에는 아래의 값이 text로 저장되어 있는데

{42457771,42457772,42457773,42457774,42457775,42457776,42457777,42474803,42477457,42487546,42491301}

 

refid::bigint[] 를 통해서 array로 캐스팅 하고

()[] 를 통해서 해당 위치의 값을 가져오도록 한다.

넣는 순서대로 되서 max 값은 가장 뒤에 일테니,

"" ""

array_length(refid::bigint[].1) 을 통해서 가장 마지막 인덱스를 얻도록 하고

인덱스로 부터 가져오면 성공!

42491301

[링크 : https://www.postgresql.org/docs/9.4/functions-array.html]

 

text로 저장된 녀석을 배열로 되살리기

select '{1,1}'::int[]

[링크 : https://stackoverflow.com/questions/47359288/convert-a-text-to-an-array-postgresql]

 

array_agg 함수에서 정렬해서 넣기

SELECT array_agg(a ORDER BY b DESC) FROM table;

[링크 : https://stackoverflow.com/questions/7317475/postgresql-array-agg-order]

Posted by 구차니

성남에서 벗어나니 하늘 시끄러운줄 몰라서 개최하는지도 몰랐네..

아마.. 한동안은 못가겠지? ㅠㅠ

 

[링크 : http://www.seouladex.com/introduction/overview.asp]

'개소리 왈왈 > 2017 에어쇼' 카테고리의 다른 글

아쉽게도 못간 ADEX 2017 ㅠㅠ  (0) 2017.10.23
ADEX 2017 일정  (0) 2017.06.22
Posted by 구차니