Skip to content

Commit

Permalink
Get-DbaDbBackupHistory - Fix for more than one database with same dat…
Browse files Browse the repository at this point in the history
…abase_guid (dataplat#7879)
  • Loading branch information
andreasjordan authored Oct 22, 2021
1 parent 5f10ac7 commit 3be4e52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/Get-DbaDbBackupHistory.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@ function Get-DbaDbBackupHistory {
JOIN msdb..backupmediaset AS mediaset ON mediafamily.media_set_id = mediaset.media_set_id
JOIN msdb..backupset AS backupset ON backupset.media_set_id = mediaset.media_set_id
JOIN (
SELECT TOP 1 database_guid, last_recovery_fork_guid
SELECT TOP 1 database_name, database_guid, last_recovery_fork_guid
FROM msdb..backupset
WHERE database_name = '$($db.Name)'
ORDER BY backup_finish_date DESC
) AS last_guids ON last_guids.database_guid = backupset.database_guid AND last_guids.last_recovery_fork_guid = backupset.last_recovery_fork_guid
) AS last_guids ON last_guids.database_name = backupset.database_name AND last_guids.database_guid = backupset.database_guid AND last_guids.last_recovery_fork_guid = backupset.last_recovery_fork_guid
WHERE (type = '$first' OR type = '$second')
$whereCopyOnly
$devTypeFilterWhere
Expand Down

0 comments on commit 3be4e52

Please sign in to comment.