I use the TableAdapter Configuration Wizard under VS2008 and use SQL Server Express.

This is my database diagram:

Database structure

And this is my SELECT statement:

SELECT        Parties.PartieID, Parties.RondeID, Parties.JoueurNoirID, Parties.JoueurBlancID, Parties.ScoreNoir, Parties.ScoreBlanc, Parties.VainqueurID, 
                         Parties.DetailVictoire, Rondes.Numero, Tournois.Nom, [B](SELECT  Pseudonyme FROM Joueurs WHERE JoueurID = Parties.JoueurNoirID) AS JoueurNoir, (SELECT  Pseudonyme FROM Joueurs WHERE JoueurID = Parties.JoueurBlancID) AS JoueurBlanc, (SELECT  Pseudonyme FROM Joueurs WHERE JoueurID = Parties.VainqueurID) AS Vainqueur[/B]

FROM            Parties INNER JOIN
                         Rondes ON Parties.RondeID = Rondes.RondeID INNER JOIN
                         Tournois ON Rondes.TournoiID = Tournois.TournoiID INNER JOIN
                         Joueurs ON Parties.JoueurBlancID = Joueurs.JoueurID AND Parties.JoueurNoirID = Joueurs.JoueurID AND Parties.VainqueurID = Joueurs.JoueurID

First, how to formulate to use JOINS instead of the SELECTs on Joueurs subqueries?

Second, is it the best to have three foreign keys related to the same parent indexed field? (i don't see how to do differently)

Any help would be very appreciated.

Greetings,

Nicolas

Can you post the table schema

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.