728x90 SMALL DB/Postgresql22 해당문자열 다른문자열로 치환 update문 tableA에서 ㈜ < 특수문자들을 (주) 2021. 12. 16. postgresql 실행중인 쿼리 확인, lock된 쿼리문 강제종류 실행중인 쿼리 조회 lock된 쿼리문의 pid확인 SELECT * FROM pg_stat_activity ORDER BY query_start ASC; 쿼리문 강제종료 put 조회한 pid SELECT pg_cancel_backend(pid); 2021. 12. 2. [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. 이전 1 2 3 4 5 6 다음 728x90 LIST