%
Dim SQL, Objdb
Dim sel_gubun : sel_gubun = Request("sel_gubun")
set Objdb = Server.CreateObject("ADODB.Recordset")
Dim sel_code : sel_code = Request("sel_code")
if sel_code = "edu" Then
sel_gubun = "edu"
End If
Select case sel_gubun
case "code"
Response.Write ""
DBConnect()
SQL = " select gubun, r_cd, r_nm, Flag from exitpoll.dbo.R_code where Flag = '1' and gubun = '" & sel_code & "' "
if sel_code = "district" Then
SQL = SQL & " and left(r_cd,2) = '" & Request("area_cd") & "' "
End If
Objdb.Open SQL,DBConn,3,1,1
if not Objdb.eof Then
while not objdb.eof
Response.Write ""
objdb.movenext
wend
End If
DBClose()
case "edu"
Response.Write ""
DBConnect()
SQL = ""
SQL = SQL & " SELECT RE.eduCd, EduArea, EduDate, EduSpace, EduEtc1, Qu, ISNULL(RC.comp_cnt, 0) AS comp_cnt, "
SQL = SQL & " CASE WHEN Qu - ISNULL(RC.comp_cnt, 0) < 0 THEN 0 ELSE Qu - ISNULL(RC.comp_cnt , 0) END AS req_cnt "
SQL = SQL & " FROM exitpoll.dbo.R_Edu RE "
SQL = SQL & " LEFT JOIN ( "
SQL = SQL & " SELECT r_edu, count(*) AS comp_cnt "
SQL = SQL & " FROM exitpoll.dbo.R_Info "
SQL = SQL & " WHERE flag = 1 AND ISNULL(r_edu, '') <> '' "
SQL = SQL & " GROUP BY r_edu "
SQL = SQL & " ) RC ON RE.EduCd = RC.r_edu "
SQL = SQL & " WHERE RE.Flag = 1 AND eduNm = '교육' "
SQL = SQL & " And EduArea like '%" & Request("area_cd") & "%' "
Objdb.Open SQL,DBConn,3,1,1
if not Objdb.eof Then
while not objdb.eof
Response.Write ""
'if cint(objdb("req_cnt")) > 0 Then
' Response.Write ""
'else
' Response.Write ""
'End If
objdb.movenext
wend
End If
DBClose()
End Select
%>