Quote Originally Posted by xld View Post
I know this thread is a bit stale, and you have probably had the interview, but if it wants the top Nth entry on a table, both the correlated sub-query approach and the more obscure OFFSET FETCH approach are beyond SQL tyro in my view, so if they need that level of skill, as a T-SQL newbie you shouldn't be applying, you will struggle.
Hi xld,

there was no time limit for the test and I was told they were testing the approach instead right exact answers as they have developers for that this is an analyst role. I just wanted to do my best even I struggled I learned a lot during this test. My final answer was like below. It was just before Christmas so I haven't had any feedback yet.

SELECT a.AccountName, co.LastName, ca.CaseNumber, q.QuoteDate, q.Value
ROW NUMBER() OVER(ORDER BY q.Value) RowID
FROM Tbl_Account a
INNER JOIN Tbl_Contact co ON a.AccountID=co.AccountID
INNER JOIN Tbl_Case ca ON co.ContactID=ca.ContactID
INNER JOIN Tbl_Quote q ON ca.CaseID=q.CaseID
WHERE RowID=3
GROUP BY a.Postcode LIKE ‘BR2%’;