Exercise #10 (tips and solutions) |
||
|
It is possible to solve the problem without use of a subquery. However, for this purpose non-standard means are used. The method is based on TOP N clause (SQL Server) which allows to extract from the sorted set the first N rows. Similar clauses are available in Here is the solution: So, sorting on decrease of the price is carried out. The result set gets one (the first - TOP 1 is used) row. However there is an issue when some printers in the table will have an identical ceiling price. The issue is being solved by means of WITH TIES clause, which will include in result set not only N rows (one in our case), but also all below going rows, for which values in column of sorting (price column in our example) coincide with values of N-th row (here is 1st). |
||


