-
Originally Posted by rgarrison
[This thread is associated with Part 19 of the SQL Credit series.]
Using the sample table and data presented here, can you come up with a worthwhile SELECT statement that uses RANK() or DENSE_RANK() in both the SELECT and ORDER BY clauses where they don’t match?
If this is never possible, can you explain why?
Query uses to list all information of the contesters whose names occur in
the contestresults table more than one for QA and cross check data.
WITH t
AS (
SELECT *,
dense_rank() over (
partition by entrant
order by weight DESC
) AS DenseRank
FROM dbo.ContestResults
)
select * from t
where entrant in
(SELECT distinct entrant
FROM t
where denseRank > 1)
order by entrant
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|