테스트 사이트 - 개발 중인 베타 버전입니다

쿼리문 조언 좀 부탁드립니다. 채택완료

유지연a 11년 전 조회 2,798

전화번호를 검색할라고 하는데요.

 

전화번호가 tel1, tel2, tel3 에 지역번호, 국번, 번호 이렇게 각각 저장이 되어 있습니다.

 

예를들어 02  -  532  -  1234 를 조회할 경우, 3개 필드를 조합해서 쿼리문을 만들 수 있는지요?

 

하나의 필드에 들어 있으면 문제가 없는데, 3개에 각각 있어서 어떻게 해야할지 고민이 듭니다.

 

아래와 비슷하게 한번에 작성할 수 없을련지요?

 

select * from g4_member where tel1, tel2, tel3 like '%전화번호%'

 

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트

</span></p><p><span style="font-family: gulim, helvetica; line-height: 23.5440006256104px; font-size: 10pt; background-color: rgb(255, 255, 255);">$tel = str_replace('-', '', $tel);</span></p><p><span style="font-family: gulim, helvetica; line-height: 23.5440006256104px; font-size: 10pt; background-color: rgb(255, 255, 255);">select * from g4_member where </span><span style="font-family: 나눔고딕, 돋움, Dotum, AppleGothic, sans-serif; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">concat</span><span style="font-size: 10pt; font-family: gulim, helvetica; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">​(tel1, tel2, tel3) like '%$tel%'</span><span style="font-size: 10pt; line-height: 1.5;">​</span></p><p><span style="font-size: 10pt; line-height: 1.5;">

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

유지연a
11년 전
질문하는것이 염치가 없어서 고민하고 있었는데, 바로 해결이 되었습니다.
감사합니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인