Created
March 28, 2012 20:17
-
-
Save skarllot/2230145 to your computer and use it in GitHub Desktop.
Gets last volume name from each pool group into Bacula database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT vc1.* | |
FROM PoolGroup AS pg | |
INNER JOIN VolumeCatalog AS vc1 ON (vc1.VolumeName LIKE pg.Filter) | |
WHERE vc1.VolumeName = | |
(SELECT VolumeName | |
FROM VolumeCatalog AS vc2 | |
WHERE vc2.VolumeName LIKE pg.Filter | |
ORDER BY VolumeName DESC | |
LIMIT 1) | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `PoolGroup` ( | |
`Id` INT NOT NULL AUTO_INCREMENT , | |
`Name` VARCHAR(45) NOT NULL , | |
`Filter` VARCHAR(20) NOT NULL , | |
`Filter_MS` VARCHAR(20) NOT NULL , | |
PRIMARY KEY (`Id`) , | |
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) ) | |
ENGINE = InnoDB | |
DEFAULT CHARACTER SET = utf8; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment