Frequency function in table restriction. Use of first and last function