이 블로그 검색

2013년 7월 21일 일요일

[mysql] Substring_index

select max(substring_index(xxxx,'-',-1)) from tb where substring_index(xxxx,'-',2)='GIS-SDS'

substring_index(xxxx,'-',-1) : xxxx라는 필드에서 '-' 로 나누어서 뒤에서 1번째(-1)껏만 보여준다.
substring_index(xxxx,'-',2) : xxxx라는 필드에서 '-' 로 나누어서 앞에서 두개 즉, 1,2번째껏을 보여준다.
(단, 중간에 '-' 도 포함해서 나온다)

ex>
xxxx 필드값이 GIS-SDS-001
이라면
substring_index(xxxx,'-',1) = GIS
substring_index(xxxx,'-',2) = GIS-SDS
substring_index(xxxx,'-',3) = GIS-SDS-001

substring_index(xxxx,'-',-1) = 001
substring_index(xxxx,'-',-2) = SDS-001
substring_index(xxxx,'-',-3) = GIS-SDS-001

2013년 7월 18일 목요일

[Javascript] A링크 Enter 키 동작

<input type="text" name="search" onkeypress="if (event.keyCode==13) { SearchValue(frm.search.value); }" …. >