Ich habe zwei Tabellen und eine Abfrage, wo ich den Text der verschiedenen IDs ausgeben möchte.SQL-Abfrage nicht korrekt
Col1 und Col2 der Tabelle A ist ein Fremdschlüssel für die PK der Tabelle B
Table A
PK Col1 Col2
1 2 3
Table B
PK Col1
2 test
3 test1
Abfrage:
select 'This is a ' + B.Col1 + 'and this is' + B.Col1 from TableA r inner join TableB k on r.Col1 = k.PK
Exklusionsverknüpfung TableB t auf r.Col2 = t.PK‘
Ergebnis ich möchte
This is a test and this is test1
Ergebnisse Im
This is a test and this is test