Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Help

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 02.04.2007, 07:36   #24
godfather
Архивный участник
 
Join Date: Oct 2005
Posts: 35
Default

i found a problem at table hero_candidate
this table updates olympiad_result...but the table scructur is wrong

Quote:
UPDATE user_nobless
SET hero_type = 0

CREATE TABLE #hero_candidate (season INT, main_class INT, char_id INT, olympiad_point INT, match_count INT, olympiad_win_count INT, olympiad_lose_count INT)
INSERT INTO #hero_candidate
SELECT olympiad.season, ud.subjob0_class, un.char_id, un.olympiad_point, un.match_count, un.olympiad_win_count, un.olympiad_lose_count
FROM olympiad, user_nobless un, user_data ud
WHERE un.char_id = ud.char_id AND un.match_count >= 5 AND un.olympiad_win_count >= 1


CREATE TABLE #highest_score (main_class INT, olympiad_point INT, match_count INT)

DECLARE @hero_candidate_class INT
DECLARE hero_candidate_cursor CURSOR FOR
SELECT DISTINCT main_class FROM #hero_candidate

OPEN hero_candidate_cursor

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class

WHILE @@FETCH_STATUS = 0
BEGIN

INSERT INTO #highest_score
SELECT TOP 1 main_class, olympiad_point, match_count
FROM #hero_candidate
WHERE main_class = @hero_candidate_class
ORDER BY olympiad_point DESC, match_count DESC

FETCH NEXT FROM hero_candidate_cursor INTO @hero_candidate_class
END

CLOSE hero_candidate_cursor
DEALLOCATE hero_candidate_cursor

CREATE TABLE #highest_score_nobless (char_id INT, main_class INT)
INSERT INTO #highest_score_nobless
SELECT c.char_id, c.main_class FROM #hero_candidate c, #highest_score s
WHERE c.main_class = s.main_class AND c.olympiad_point = s.olympiad_point AND c.match_count = s.match_count

CREATE TABLE #hero (char_id INT, main_class INT)
INSERT INTO #hero
SELECT char_id, main_class FROM #highest_score_nobless WHERE main_class IN (SELECT main_class FROM #highest_score_nobless GROUP BY main_class HAVING COUNT(main_class) = 1)

UPDATE user_nobless
SET hero_type = 1, win_count = win_count+1
WHERE char_id IN (SELECT char_id FROM #hero)

UPDATE user_nobless
SET previous_point = olympiad_point

UPDATE user_nobless
SET olympiad_point = 0, match_count = 0, olympiad_win_count = 0, olympiad_lose_count = 0

INSERT INTO olympiad_result
SELECT season, main_class, char_id, olympiad_point, match_count, olympiad_win_count, olympiad_lose_count FROM #hero_candidate

INSERT INTO olympiad
(step, season_start_time) VALUES (@new_step, @new_season_start_time)

SELECT @@IDENTITY

GO
i think thats the right query
i encountered problem in my server.i didnt have heroes at the end of the month
godfather is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:17.