# Select all distinct Client/FileSet combinations that have at least one
# completed backup Job, for the "restore latest" quick-restore picker.
# This intentionally lists any completed backup, not only ones with a
# Full level, so the picker always shows every tuple that has ever been
# backed up; the later chain-resolution step reports if no Full backup
# is actually available for the chosen tuple.

SELECT DISTINCT Client.Name, FileSet.FileSet
  FROM Job, Client, FileSet
 WHERE Job.ClientId   = Client.ClientId
   AND Job.FileSetId  = FileSet.FileSetId
   AND Job.JobStatus IN ('T','W')
   AND Job.Type       = '%c'
 ORDER BY Client.Name, FileSet.FileSet
