SQL (1) 리스트형 [MySQL] SELECT 결과물을 파일로 저장하기. DB 데이터를 파일로 추출하여 엑셀파일로 작업해야하는 경우가 생기기도 합니다. 아래 쿼리는 DB 명령프롬프트 창에서 해당 SELECT문을 파일로 저장하는 쿼리 예제입니다. SELECTusers.id, ifnull(payment.payment_count, 0) as payment_countINTO OUTFILE '20170101_paycount.log' FIELDS TERMINATED BY '|'FROM(select id from users where (withdraw_date > '2016-01-01' and withdraw_date < '2016-12-31') or withdraw_date is null) usersLEFT JOIN(select order_user_id as id, count(payme.. 이전 1 다음