September 25, 2008 at 3:29 am
Hi all and thx for your support, i have readTimothy Khouri's article - Understanding SQL: Many to Many Relationships.
My database diagram is the following:
The query is:
SELECT Voyage.VoyageID, Voyage.SocieteID, Voyage.PAX, Voyage.PrixVente, Voyage.PrixAchat, Voyage.EtatAvancement, Voyage.EtatOption
FROM Voyage INNER JOIN
Voyages_Vols ON Voyage.VoyageID = Voyages_Vols.VoyageID INNER JOIN
Vol ON Voyages_Vols.VolID = Vol.VolID
WHERE (Voyage.VoyageID IN
(SELECT VoyageID
FROM Voyages_Vols
WHERE (VolID = @VolID)))
I have no result (the parameter value @VolID is correct).
I want to retrieve all Voyages where VolID = @VolID (and later all Vols where VoyageID = @VoyageID).
September 25, 2008 at 3:44 am
HI There,
Ok to get to the VolId I don't think you need to join all the way to the Vol table as you aren't returning or restricting any data from that table.
try this:
[font="Courier New"]
SELECT
Voyage.VoyageID,
Voyage.SocieteID,
Voyage.PAX,
Voyage.PrixVente,
Voyage.PrixAchat,
Voyage.EtatAvancement,
Voyage.EtatOption
FROM Voyage
INNER JOIN Voyages_Vols
ON Voyage.VoyageID = Voyages_Vols.VoyageID
WHERE Voyages_Vols.VolID = @VolID[/font]
----------------------------------------------
Try to learn something about everything and everything about something. - Thomas Henry Huxley
:w00t:
Posting Best Practices[/url]
Numbers / Tally Tables[/url]
September 25, 2008 at 5:46 am
All is right. Thx for your reactivity and advise.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply