Skip to main content

Editing SQL

Now all we need to do is add “TOP 3” to SELECT clause of our SQL query and recompile the class.

—TopFilms—
TopFilms

   Query TopFilms() As %SQLQuery(CONTAINID = 1)
    {
        SELECT TOP 3 %ID,Description,Length,Rating,Title,Category->CategoryName 
        FROM Film
        WHERE (PlayingNow = 1)
        ORDER BY TicketsSold DESC
    }

The TOP 3 statement indicates that we are only interesting in the first 3 rows returned by this query.

FeedbackOpens in a new tab