Hi there,
maybe someone can help me with the syntax of the sql query with INNNER JOIN. If I use only one table in the sql query everything works fine. But if I tried to join the tables with INNER JOIN I dont’ know how to to get it work! I tried it for example with
Modell = $_.M.Modell
but it doesn’t work
$Data = Invoke-DbaQuery -SqlInstance localhost\SQLEXPRESS -Database test -Query "select M.Modell, M.Beschreibung, G.IMEI FROM Modelle AS M INNER JOIN Geraete AS G ON M.Modell = G.Modell" | ForEach-Object {
@{
Modell = $_.M.Modell
Beschreibung = $_.M.Beschreibung
IMEI = $_.G.IMEI
}
}
$Columns = @(
New-UDTableColumn -Property 'Modell' -Title 'Modell' -ShowSort -IncludeInExport -IncludeinSearch -ShowFilter -Filtertype text
New-UDTableColumn -Property 'Beschreibung' -Title 'Beschreibung' -ShowSort -IncludeInExport -IncludeinSearch -ShowFilter -Filtertype text
New-UDTableColumn -Property 'IMEI' -Title 'IMEI' -ShowSort -IncludeInExport -IncludeinSearch -ShowFilter -Filtertype select
)
New-UDTable -Id 'TBSQLAbfrageModelleTest1' -Data $Data -Columns $Columns -ShowSearch -ShowPagination -Dense -Export