Skip to content
Advertisement

Issue with join and using same table column twice in selection

I’m having bit of issue with joins here: Tasking is to select Item code, Item name and Concat together that items prerequisites item code and name together.

I can get the select to work to show item code, item name correctly and the prerequisite code in the concat, but not the name of it. What’s causing the pre-requisite item name to remain wrong here? Query response I’m looking for should come as this:

But what i’m getting is this: (it’s supposed to be using the Prerequisite ingredient_code (correct in concat) to find the name corresponding to it from Item.Item_name, but it’s matching up as wrong name)

Code I’m using:

Advertisement

Answer

You want a second join for the prerequisite item. Without sample data it is hard to be sure which columns line up, but I thin you want:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement