❔ Getting SQL data from a relationship table
Hello, for my school assignment I have to make a winforms app. Currently I have 3 tables in my SQL Database and 2 models in my code. The tables are shown in the picture and my Student class looks like this:
Since the student class has a list of outfits I made a relationship table in my SQL database but I have no idea on how to retrieve this in the most efficient way possible.
Currently I run the following queries:
after that I use:
After that I run
It feels like I'm doing unnecessary steps, is it possible to do all of this in one query ?
Since the student class has a list of outfits I made a relationship table in my SQL database but I have no idea on how to retrieve this in the most efficient way possible.
Currently I run the following queries:
"SELECT Id, Name, StudentNumber, Password, XP FROM Students" after that I use:
SELECT OutfitId WHERE StudentId = @idAfter that I run
SELECT Id, Name, Description, ImageURL, Cost WHERE Id = @idIt feels like I'm doing unnecessary steps, is it possible to do all of this in one query ?
