반응형
//MS SQL 2000
select
    tb.snum,
    ta. code,
    tc.user_name,
    ta.title,
    ta.contents,
    ta.filename,
    ta.filedata
from board01 as ta,
(
    select count(b.code) as snum, b.code
    from board01 as a,
    (
        select code from board01
    ) as b
    where a.code >= b.code
    group by b.code
) as tb,
info_users as tc
where ta.code = tb.code
and ta.writer = tc.user_id

//MS SQL 2005
select (Row_number() Over(Order By Refer desc, Step)) as aaa,* from t_board2


MS SQL 2000은 Row_number함수를 지원하지 않는다.
사용자가 함수를  직접 만들어서 사용하거나 서브쿼리를 만들어서 카운트를 지정한후 
직접 Row number를 뽑아내는 수 밖에 없다.

+ Recent posts