순위내기..등수뽑아오기
페이지 정보
본문
select * from (
select a.id, u.name, (select count(*)+1 as myRank from rankeytable p join MemBer m on m.id=p.id and m.outyn='N' where
CONCAT(LPAD(p.maxAscore ,10,'0'),LPAD(p.maxBscore ,10,'0'),(10000000000 - unix_timestamp(p.regdate))) >
CONCAT(LPAD(a.maxAscore ,10,'0'),LPAD(a.maxBscore ,10,'0'),(10000000000 - unix_timestamp(a.regdate))) ) as rank
from rankeytable a join MemBer u on u.id=a.id and outyn='N' where a.ymddate='2014-06-10') as m
where m.rank >0 order by m.rank limit 0,10
순위 앞뒤 몇명이면...
where m.rank between A and B order by m.rank limit 0,10
----------------------------------------------------------------------
특정한 등수 이후의 10명...
select no, CONCAT(date_format(regdate,'%Y%m%d'),10-priceRk) as orderbypoint from tablename
where CONCAT(date_format(regdate,'%Y%m%d'),10-priceRk) < CONCAT('$row[ymddate]',10-$row[priceRk])
order by orderbypoint desc
limit 0,10
select a.id, u.name, (select count(*)+1 as myRank from rankeytable p join MemBer m on m.id=p.id and m.outyn='N' where
CONCAT(LPAD(p.maxAscore ,10,'0'),LPAD(p.maxBscore ,10,'0'),(10000000000 - unix_timestamp(p.regdate))) >
CONCAT(LPAD(a.maxAscore ,10,'0'),LPAD(a.maxBscore ,10,'0'),(10000000000 - unix_timestamp(a.regdate))) ) as rank
from rankeytable a join MemBer u on u.id=a.id and outyn='N' where a.ymddate='2014-06-10') as m
where m.rank >0 order by m.rank limit 0,10
순위 앞뒤 몇명이면...
where m.rank between A and B order by m.rank limit 0,10
----------------------------------------------------------------------
특정한 등수 이후의 10명...
select no, CONCAT(date_format(regdate,'%Y%m%d'),10-priceRk) as orderbypoint from tablename
where CONCAT(date_format(regdate,'%Y%m%d'),10-priceRk) < CONCAT('$row[ymddate]',10-$row[priceRk])
order by orderbypoint desc
limit 0,10
- 이전글백업 받은 frm, isd, ism 사용법 21.02.10
댓글목록
등록된 댓글이 없습니다.