select a.userno dtype
from users a
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
select a.userno dtype, count(b.mno) intval
from users a
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
select a.dtype,sum(a.intval) intval,sum(a.intval2) intval2
from (
select a.userno dtype,count(b.mno) intval,0 intval2
from users a
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
group by a.userno
union all
select a.userno dtype,0 intval,count(b.userno) intval2
from users a
left outer join alarms b on b.userno=a.userno and b.isdel=0
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
group by a.userno
) a
group by a.dtype
select a.dtype,sum(a.intval) intval,sum(a.intval2) intval2,sum(a.intval3) intval3,sum(a.intval4) intval4,sum(a.intval5) intval5
,sum(a.intval6) intval6,sum(a.intval7) intval7,sum(a.intval8) intval8,sum(a.intval9) intval9,sum(a.intval10) intval10
,sum(a.intval11) intval11
,max(a.strval) strval,max(a.strval2) strval2,max(a.strval3) strval3
from (
select a.userno dtype,count(b.mno) intval,0 intval2,0 intval3,0 intval4,0 intval5
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
,0 intval11
,null strval,null strval2,null strval3
from users a
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
group by a.userno
union all
select a.userno dtype,0 intval,count(b.userno) intval2,0 intval3,0 intval4,0 intval5
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
,0 intval11
,null strval,null strval2,null strval3
from users a
left outer join alarms b on b.userno=a.userno and b.isdel=0
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
union all
select a.userno dtype,0 intval,0 intval2,c.tyear intval3,c.tseq intval4,b.classno intval5
,b2.isplan intval6,b2.iscontent intval7,b2.isev intval8,b2.isrs intval9,b2.isgrade intval10
,b.cmno intval11
,d.cgname strval,b.cname strval2
,group_concat(case when f.bmno is null then null else concat(f.bmno,':',f.bmname,':',f.bmtype) end separator ';') strval3
from users a0
inner join lect a on a.lectno=#lectno# and a.userno=a0.userno and a.status=1 and a.ischanged=0
inner join cm b on b.cmno=a.cmno
inner join cmmenu b2 on b2.cmno=b.cmno
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno
left outer join cmmenubm e on e.cmno=b.cmno
left outer join boardmaster f on f.bmno=e.bmno
where a0.userno=#userno# and (a0.loginkey=#loginkey# or #IsDupCheck#=0)
group by a.userno,b.cmno,c.tyear,c.tseq,b.classno
,b2.isplan,b2.iscontent,b2.isev,b2.isrs,b2.isgrade
,d.cgname,b.cname
) a
group by a.dtype
select a.*,b.asname strval4,c.fileurl
from (
select a.dtype,sum(a.intval) intval,sum(a.intval2) intval2,sum(a.intval3) intval3,sum(a.intval4) intval4,sum(a.intval5) intval5
,sum(a.intval6) intval6,sum(a.intval7) intval7,sum(a.intval8) intval8,sum(a.intval9) intval9,sum(a.intval10) intval10
,sum(a.intval11) intval11
,max(a.strval) strval,max(a.strval2) strval2,max(a.strval3) strval3
from (
select a.userno dtype,count(b.mno) intval,0 intval2,0 intval3,0 intval4,0 intval5
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
,0 intval11
,null strval,null strval2,null strval3
from users a
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
group by a.userno
union all
select a.userno dtype,0 intval,count(b.userno) intval2,0 intval3,0 intval4,0 intval5
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
,0 intval11
,null strval,null strval2,null strval3
from users a
left outer join alarms b on b.userno=a.userno and b.isdel=0
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
union all
select a.userno dtype,0 intval,0 intval2,c.tyear intval3,c.tseq intval4,b.classno intval5
,b2.isplan intval6,b2.iscontent intval7,b2.isev intval8,b2.isrs intval9,b2.isgrade intval10
,b.cmno intval11
,d.cgname strval,b.cname strval2
,group_concat(case when f.bmno is null then null else concat(f.bmno,':',f.bmname,':',f.bmtype) end separator ';') strval3
from users a0
inner join lect a on a.lectno=#lectno# and a.userno=a0.userno and a.status=1 and a.ischanged=0
inner join cm b on b.cmno=a.cmno
inner join cmmenu b2 on b2.cmno=b.cmno
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno
left outer join cmmenubm e on e.cmno=b.cmno
left outer join boardmaster f on f.bmno=e.bmno
where a0.userno=#userno# and (a0.loginkey=#loginkey# or #IsDupCheck#=0)
group by a.userno,b.cmno,c.tyear,c.tseq,b.classno
,b2.isplan,b2.iscontent,b2.isev,b2.isrs,b2.isgrade
,d.cgname,b.cname
) a
group by a.dtype
) a
inner join assign b on b.subdomain=#subdomain#
left outer join fileinfo c on c.fgno=b.sitelogo
select a.*
from (
select a.sendno,a.etitle,a.semail,a.fgno,a.cdt,a.rcvcount,a.readcount
,count(b.sendno) bancount
,c.username cnoname
,row_number() over(order by a.cdt desc) rno,count(a.cdt) over() pagetotalcount
from emailsend a
left outer join emailban b on b.sendno=a.sendno
inner join users c on c.userno=a.cno
where a.isdel=0
group by a.sendno,a.etitle,a.semail,a.fgno,a.cdt,a.rcvcount,a.readcount,c.username
) a
order by a.rno
select a.sendno,a.ehtml,a.etitle
from emailsend a
left outer join emailban b on b.sendno=a.sendno
where a.sendno=#sendno# and a.isdel=0
select a.sendno,a.etitle,a.rcvs,ifnull(a.sendeds, ' ') sendeds,ifnull(group_concat(b.email separator ';'), ' ') bans
from emailsend a
left outer join emailban b on b.sendno=a.sendno
where a.sendno=#sendno# and a.isdel=0
group by a.sendno,a.rcvs,a.etitle,a.sendeds
insert into emailsend(etitle,semail,ehtml,fgno,cmno,rcvs,reademails,rcvcount,readcount, )
values (#etitle#,#semail#,#ehtml#,#fgno#,#cmno#,#rcvs#,#reademails#,#rcvcount#,#readcount#, )
SELECT LAST_INSERT_ID()
select email semail from emailbanpool where email in ($emails$)
update emailsend set isdel=0,readcount=#readcount#,sendeds=#sendeds# where sendno=#sendno#
insert into emailban(sendno,email, )
values
(#sendno#,#Ds[].bans#,now(),#Ds[].uno#,now(),#Ds[].uno#,#Ds[].uip#)
select a.*
from (
select a.mno,a.userno,a.isread,a.cdt
,b.mtitle
,u.username sendusername
,u.usertype sendusertype
,u.userid senduserid
,CAST(AES_DECRYPT(UNHEX(u.email), ) AS char) Email
, row_number() over(order by a.cdt desc) rno
, count(a.cdt) over() pagetotalcount
from memouser a
inner join memo b on b.mno=a.mno
left outer join users u on u.userno=b.cno
where a.isdel=0
and a.userno=#userno#
) a
order by a.rno
select count(a.mno)
from memouser a
where a.userno=#userno# and and a.isread=0 and a.isdel=0
update memouser set isdel=1, where userno=#uno#
update memo set isdel=1, where cno=#uno#
update memouser set isdel=1,
where userno=#uno#
and mno in ($mnos$)
and mno=#mno#
update memo set isdel=1, where cno=#uno#
and mno in ($mnos$)
and mno=#mno#
select a.*
from (
select a.mno,a.mtitle,a.cdt,count(b.mno) mucount
, sum(b.isread) ccount
, row_number() over(order by a.cdt desc) rno
, count(b.cdt) over() pagetotalcount
from memo a
inner join memouser b on b.mno=a.mno
where a.isdel=0
and a.cno=#userno#
group by a.mno,a.mtitle,a.cdt
) a
order by a.rno
insert into memo (pmno,mtitle,mcontents,fgno,Isdel, )
values (#pmno#,#mtitle#,#mcontents#,#fgno#,0, ,#cno#, ,#uno#,#uip#);
insert into memouser (mno,userno,isread,isdel, )
select LAST_INSERT_ID(),userno,1,0,0,
from users where userno in ($usernos$) and isdel=0
insert into memo (pmno,mtitle,mcontents,fgno,isdel, )
values (#pmno#,#mtitle#,#mcontents#,#fgno#,0, ,#cno#, ,#uno#,#uip#);
insert into memouser (mno,userno,isread,isdel, )
select LAST_INSERT_ID(),userno,1,0,0,
from users
where usertype in ($usertype$) and isdel=0
insert into memo (pmno,cmno,mtitle,mcontents,fgno,isdel, )
values (#pmno#,#cmno#,#mtitle#,#mcontents#,#fgno#,0, );
insert into memouser (mno,userno,isread,isdel, )
select LAST_INSERT_ID(), a.userno,0,0,
from users a
where a.userno in ($usernos$)
select a.mno,b.isread,a.cdt,b.rdate
,u.username,u.usertype sendusertype
,CAST(AES_DECRYPT(UNHEX(u.userid), ) AS char) email
,u.userid zstring0
from memo a
inner join memouser b on b.mno=a.mno
left outer join users u on u.userno=b.userno
a.mno=#mno#
a.mno in ($mnos$)
order by a.mno
update memouser set isread=1,rdate=now() where mno=#mno# and userno=#readuser#;
select a.mno,u.username cnoname,a.cdt,a.mtitle,a.mcontents,a.fgno,a.cno
,u.usertype
from memo a
left outer join users u on u.userno=a.cno
inner join memouser b on b.mno=a.mno and b.userno=#readuser# and b.isdel=0
where a.mno=#mno# and a.cno=#cno#
update memouser set isread=1,rdate= where mno=#mno# and userno=#userno#;
select a.mno,u.username,a.isread,a.rdate
from memouser a
left outer join users u on u.userno=a.userno
where a.mno=#mno# and a.userno=#userno#
order by u.username
select a.mno,b.mcontents,a.ACount,a.FTCount,a.SCount,a.LCount,a.MCount,a.ECount,a.ccount,b.cdt,c.username cnoname
from (
select a.mno,a.rno,a.pagetotalcount
,sum(case when b.isok=1 and b.smstype='A' then 1 else 0 end) ACount
,sum(case when b.isok=1 and b.smstype='FT' then 1 else 0 end) FTCount
,sum(case when b.isok=1 and b.smstype='S' then 1 else 0 end) SCount
,sum(case when b.isok=1 and b.smstype='L' then 1 else 0 end) LCount
,sum(case when b.isok=1 and b.smstype='M' then 1 else 0 end) MCount
,sum(case when b.isok < 1 then 1 else 0 end) ECount
,count(b.mno) ccount
from (
select a.mno,a.rno,a.pagetotalcount
from (
select a.mno
, row_number() over(order by a.cdt desc) rno
, count(a.cdt) over() pagetotalcount
from sms a
where a.cno=#userno#
) a
) a
inner join smsuser b on b.mno=a.mno
group by a.mno,a.rno,a.pagetotalcount
) a
inner join sms b on b.mno=a.mno
inner join users c on c.userno=b.cno
order by a.rno
insert into sms(cmno,mcontents, )
values (#cmno#,#mcontents#, );
SELECT LAST_INSERT_ID()
insert into smsuser (mno,userno,smstype,isok,msgid,message, )
values
(#mno#,#Users[].userno#,#Users[].smstype#,#Users[].isok#,#Users[].msgid#,#Users[].message#,now(),#uno#,now(),#uno#,#uip#)
select c.asname,b.usertype,b.username
,CAST(AES_DECRYPT(UNHEX(b.mobile), ) AS char) mobile
,a.smstype,a.isok
,row_number() over(order by b.username) rno, count(a.cno) over() pagetotalcount
from smsuser a
inner join users b on b.userno=a.userno
left outer join assign c on c.asno=b.asno
where a.mno=#mno#
order by b.username
select b.cnt intval,c.cnt0 intval2,c.cnt1 intval3,d.cnt intval4,e.cnt intval5,f.cnt intval6
from (select 1 col1) a
left outer join (select count(mno) cnt from memouser where userno=#userno# and isread=0 and isdel=0) b on 1=1
left outer join (
select sum(case when a.bmposition=0 then 1 else 0 end) cnt0,sum(case when a.bmposition=1 and b.cmno is not null then 1 else 0 end) cnt1
from boardmaster a
inner join board b on b.bmno=a.bmno and b.pbno is null and b.isdel=0 and b.isopen=1
left outer join board c on c.pbno=b.bno and c.isdel=0
where a.bmtype=2 and a.isopen=1 and c.bno is null and a.disptype=0
) c on 1=1
left outer join (
select count(a.rfdno) cnt
from payrfd a
left outer join pay b on b.payno = a.payno
where a.rstatus=0 and b.rstatus=0
) d on 1=1
left outer join (
select count(a.payno) cnt
from paydvr a
inner join pay b on b.payno=a.payno and b.pstatus=1 and b.rstatus=0
inner join payitem c on c.payno = b.payno
inner join book bb on bb.bkno=c.itemno
where a.dvrcode is null and a.isdvr=1
) e on 1=1
left outer join (
select count(a.payno) cnt
from paytax a
inner join pay b on b.payno=a.payno and b.pstatus in (1,22) and b.rstatus < 2
where a.taxdate is null and ifnull(a.iscancel,0) = 0
) f on 1=1
update authkey set jobkey=#jobkey#,randkey=#randkey#,keytime=date_add(now(), interval 1 minute)
where authtype=#authtype# and userno=#userno#;
insert into authkey (authtype,userno,jobkey,randkey,keytime)
select a.authtype,a.userno,a.jobkey,a.randkey,date_add(now(), interval 1 minute)
from (select #authtype# authtype,#userno# userno,#jobkey# jobkey,#randkey# randkey) a
left outer join authkey b on b.authtype=a.authtype and b.userno=a.userno
where b.authtype is null
select jobkey
from authkey where authtype=#authtype# and userno=#userno# and randkey=#randkey# and keytime > now()
update ct set authkey=#intval30# where ctno=#intval#
update question set authkey=#intval30# where qno=#intval#
select ctno intval,ismenu intval2,ctype intval3,ccode strval
from ct
where ctno=#ctno# and authkey=#authkey#;
update ct set authkey=null where ctno=#ctno#
select qno intval
from question
where qno=#qno# and authkey=#authkey#;
update question set authkey=null where qno=#qno#