No announcement yet.

Double sql select? (I think?)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Double sql select? (I think?)


    I have a N-N - Relations table that has two fields (partID and modelID).

    this table is to keep track of parts (partID) that can go on multiple vehicle models (modelID).

    Now I'm trying to do an automatic lookup of parts that are available for the selected car model.

    ex. the user selects "Ford-150" and in the next drop down it only shows part options for the F-150.

    Trouble is when I do the lookup it returns the partID, modelID of the correct related Model that was selected but how do I get the "Parts Name"

    to show up and not the PartID ?

    I have this....

    SELECT partID, modelID
    FROM tb_parts_models
    WHERE modelID = '{cart_model}'
    ORDER BY modelID

    Which returns the correct partID & modelID of the user selected model but populates the part drop down with (ex. 15 - 6) which should be displayed to the user as "Fender".

    15 is the part Fender and 6 is the model F-150.

    Any help is greatly appreciated!!