I have a many-to-many relationship between two tables.
Table God_Restaurants
contains my restaurants.
Table God_RestaurantKat
contains the different categories.
Table God_RestKatReference
contains two columns each holding the id of the two tables.
The follwing statement is what I can come up with, but does not give me the output that i want.
DECLARE @Names VARCHAR(8000)
SELECT DISTINCT R.RestaurantID as Restaurantid,
R.RestaurantName as Restaurantname,
K.RestaurantKatName as RestKatName
FROM God_Restaurants R
LEFT JOIN God_RestKatReference as GodR ON R.RestaurantId = Godr.RestaurantId
LEFT JOIN God_RestaurantKat as K ON GodR.RestaurantKatId = K.RestaurantKatId
WHERE R.RestaurantPostal = 7800
I would like the output to be informations about the restaurant and in the last column, a concatenated row of categories.