반응형


mysql> select * from tableA;
+-----------+------+
| name      | age  |
+-----------+------+
| 임상현 |   30 |
| 김희철 |   30 |
| 이진희 |   34 |
| 김재언 |   37 |
| 정경호 |   30 |
+-----------+------+
5 rows in set (0.00 sec)

위와 같은 테이블에서 age가 30인 사람들의 열을 한필드에 뽑아 오고 싶을때

mysql> select group_concat(name)as names, age from tableA where age=30;
+-------------------------------+------+
| names                         | age  |
+-------------------------------+------+
| 임상현,김희철,정경호 |   30 |
+-------------------------------+------+
1 row in set (0.00 sec)

위와 같이 하면 names에 (임상현,김희철,정경호)의 값을 불러 올 수가 있다.
반응형

'MYSQL' 카테고리의 다른 글

mysql custom 값으로 정렬하기  (0) 2020.04.06
mysql CONCAT  (0) 2011.05.22
union  (0) 2011.03.28
반응형

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
	<style type="text/css">
		#diva {
			height:2500px;
		}
		#scrollBtn1,#scrollBtn2 {
			cursor:pointer;
		}
	</style>
	<script type="text/javascript">
		$(document).ready(function(){

			$("#scrollBtn1").click(function(){
				//divb의 top의 위치 값으로 이동
				var pos=$("#divb").position().top;
				$("html, body").animate({scrollTop:pos},'slow');
			});

			$("#scrollBtn2").click(function(){
				$("html, body").animate({scrollTop:0},'slow');
			});
		});
	</script>
</head>
<body>
	<div id="diva"> 
		맨위
		<p id="scrollBtn1">[맨아래로 이동]</p>
	</div>
	<div id="divb">
		맨 아래 
		<p id="scrollBtn2">[맨위로 이동]</p>
	</div>
</body>
</html>


dd
해당 페이지 맨위와 divb(맨 아래)로 애니메이션 이동

확인:http://azit4u.phps.kr/jquery/scrollTop.html
반응형
반응형
하이퍼 링크가 작동 하지않는다.


$(".roll").click(function(event) {
	event.preventDefault();
});

반응형
반응형
hover(마우스오버시 이벤트,마우스아웃시 이벤트)

$("#button").hover(
	function() {
		$(this).addClass("hover");
	},
	function() {
		$(this).removeClass("hover");
	}
);


$("#button").hover(function(){
	$("#button").toggleClass("hover");
});


위 두 소스는 같은 결과를 출력

toggleClass() - 선택한 엘리먼트에 클래스가 이미 적용되어 있으면 해당 클래스를 제거 하고 그렇지 않으면
                       해당 클래스를 적용 한다.

toggle(handler0,handler1) - 선택한 엘리먼트에 두개 이벤트 연결 한번 실행 마다 0,1 의 핸들러 함수 실행


$("#button").toggle(
	function(){
		$(this).removeClass("hover2");
		$(this).addClass("hover");
	},
	function(){
		$(this).removeClass("hover");
		$(this).addClass("hover2");
	}
);

반응형

+ Recent posts