-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor/#431] 이메일을 통한 아티클 조회 메인페이지 조회수 API에 포함되도록 쿼리 수정 #432
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
오프셋 관련select row_rank_tb.OFFSET
from (
select
tvc.ARTICLE_ID as `ARTICLE_ID`,
row_number() over (order by
tvc.VIEW_COUNT desc,
tvc.ARTICLE_ID desc
) as `OFFSET`
from (
// 이메일 전송 기록의 오픈 이벤트와 아티클 조회수를 합친다.
select
`ARTICLE_VIEW_COUNT`.`ARTICLE_ID`,
(`ARTICLE_VIEW_COUNT`.`VIEW_COUNT` + ifnull(
evc.VIEW_COUNT,
0
)) as `VIEW_COUNT`
from `ARTICLE_VIEW_COUNT`
left outer join (
select
`SEND_ARTICLE_EVENT_HISTORY`.`ARTICLE_ID`,
count(`SEND_ARTICLE_EVENT_HISTORY`.`ARTICLE_ID`) as `VIEW_COUNT`
from `SEND_ARTICLE_EVENT_HISTORY`
group by `SEND_ARTICLE_EVENT_HISTORY`.`ARTICLE_ID`
) as `evc`
on `ARTICLE_VIEW_COUNT`.`ARTICLE_ID` = evc.ARTICLE_ID
) as `tvc`
) as `row_rank_tb`
where row_rank_tb.ARTICLE_ID = 1 |
…refactor/#431_belljun3395
오프셋 기준으로 아티클 아이디 조회select
article_view_count_offset_tb.ARTICLE_ID as `articleId`,
article_view_count_offset_tb.VIEW_COUNT as `views`
from (
// 이메일 전송 기록의 오픈 이벤트와 아티클 조회수를 합친다.
select
`ARTICLE_VIEW_COUNT`.`ARTICLE_ID`,
(`ARTICLE_VIEW_COUNT`.`VIEW_COUNT` + ifnull(
evc.VIEW_COUNT,
0
)) as `VIEW_COUNT`,
`ARTICLE_VIEW_COUNT`.`CATEGORY_CD`
from `ARTICLE_VIEW_COUNT`
left outer join (
select
`SEND_ARTICLE_EVENT_HISTORY`.`ARTICLE_ID`,
count(`SEND_ARTICLE_EVENT_HISTORY`.`ARTICLE_ID`) as `VIEW_COUNT`
from `SEND_ARTICLE_EVENT_HISTORY`
group by `SEND_ARTICLE_EVENT_HISTORY`.`ARTICLE_ID`
) as `evc`
on `ARTICLE_VIEW_COUNT`.`ARTICLE_ID` = evc.ARTICLE_ID
order by
(evc.VIEW_COUNT) desc,
`ARTICLE_VIEW_COUNT`.`ARTICLE_ID` desc
limit 9223372036854775807
offset 0
) as `article_view_count_offset_tb`
where article_view_count_offset_tb.CATEGORY_CD = 0
limit 11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎫 연관 이슈
resolved: #431
💁♂️ PR 내용
🙏 작업
🙈 PR 참고 사항
📸 스크린샷
🤖 테스트 체크리스트