Cute Happy Ghost
본문 바로가기
728x90
SMALL

DB47

postgresql 실행중인 쿼리 확인, lock된 쿼리문 강제종류 실행중인 쿼리 조회 lock된 쿼리문의 pid확인 SELECT * FROM pg_stat_activity ORDER BY query_start ASC; 쿼리문 강제종료 put 조회한 pid SELECT pg_cancel_backend(pid); 2021. 12. 2.
mybatis collection size 길이 체크, null체크 mybatis에서 collection을 사용해야하는데 만약 collection이 null이라면 다른 조건을 실행해야 할 때 if나 when을 써서 test ="info != null and info.size != 0" 이런식으로 하면 null check 완료 info는 collection 이름.. select tcc.comm_nm as "rcy_cd" ,tfi.fclt_nm as "fclt_nm" ,th.old_valas "oldValue" ,th.new_val as "value" ,th.mdfy_resn AS "mdfy_resn" ,th.user_id AS "user_id" ,TO_CHAR(th.reg_date, 'yyyy-mm-dd')AS "reg_date" from t_hist_life_mrs th.. 2021. 11. 15.
[postgresql] case when true false 조건에 따라 출력하는법, 중복방지 글쓰기 where 절에 있는 조건의 애들이 맞는 데이터들이 0개면 false 아니면 true ajax를 써서 false면 글을 쓸 수 있게 true면 글작성이 안되게 select CASE WHEN count(*) = 0 THEN false ELSE true END from t_record_amt_life_rcy where sgg_cd = #{sgg} and fclt_year =#{fclt_year} 2021. 11. 15.
postgresql count여러개 보기 각 카테고리별 항목수 확인 ratio_stdr_cd에 각각 RS00101,RS00102,RS00103,RS00104,RS00105가 있는데 얘네의 데이터들이 몇개나 있는지 확인할 때 쿼리 하나만 쓰는게 아니라 한번에 보고싶을 때 쓰는 쿼리 filter 사용 select * from t_ratio_cd trc ; select count(1) filter (where ratio_stdr_cd = 'RS00101') as "RS00101", count(1) filter (where ratio_stdr_cd = 'RS00102') as "RS00102", count(1) filter (where ratio_stdr_cd = 'RS00103') as "RS00103", count(1) filter (where ratio_stdr_cd = .. 2021. 11. 15.
728x90
LIST