Date: 27-02-12 02:31
I had a bunch of tapes that I had labelled manually. Later, I got a tape library, which could read tape labels. Thus, I wanted to relabel the tapes, but had to delete the old volumes from the Bacula database. First, I needed to know what tapes where relabeled. This query told me that.
Fortunately, the labels I used manually were based on the bar code label.
SELECT media.volumename as NEW, M.volumename as OLD
FROM media, (SELECT volumename, substr(volumename, 9) || 'S2' AS newmedianame
FROM media M
WHERE volumename LIKE 'DLT7000-JYN%') AS M
WHERE media.volumename = m.newmedianame
order by 2