Speaking about SQL, I have noted something really interesting in MS SQL Server Management Studio, which would probably be of use in MS Access as well. This is the saved custom view. It is not present in MS Access, but it is pretty close to the saved query there, although I am not sure whether in MS Access the saved query is that optimized.
Anyway, I will show how to create a custom view. Thus, I will use the table from the previous article for the chess players.
Let’s imagine that for a reason, the king who was cheated wanted to have a view of the last 3 values of the chess board, that he had to pay with grain. As far as I had an overflow of the big int value, I have reached up to 63. Thus, the last 3 values are these:
They are achieved with the following SQL command:
1 2 |
SELECT TOP(3) PaidPerCell "Top Values", Cell FROM Money ORDER BY PaidPerCell DESC |
So, if we want to create a view about this sql, we simply have to add a line above like this:
1 2 3 |
CREATE VIEW [Top 3 DESC] AS SELECT TOP(3) PaidPerCell "Top Values", Cell FROM Money ORDER BY PaidPerCell DESC |
And now in Views we get a view named “Top 3 DESC”. If we click “Design”, we may see even the SQL used for the creation of the view here:
Thus, at the end, we may use the view as a separate table – thus, a request for the top value would look like this:
Pretty much that is it! 🙂
I hope you enjoyed it! 😀