Question
Advanced SQL Help
How would i write this SQL statement?
I have a table of products that i am trying to get. I have another table that holds relations for various things. In my SQL i am trying to get products that may have more than one relation in the second table. So, for example, say i want to get product ID 1. In my where statement, i also say ID 1 should have x relationship in the relations table AND y relation in the same table.... I am able to get it to work if i leave the y relation out. I am assuming that the SQL is treating these as two different records so it will only display either the x relation or y relation.
I need a work around and do not want use Unions as i would then get two different results.
I have a table of products that i am trying to get. I have another table that holds relations for various things. In my SQL i am trying to get products that may have more than one relation in the second table. So, for example, say i want to get product ID 1. In my where statement, i also say ID 1 should have x relationship in the relations table AND y relation in the same table.... I am able to get it to work if i leave the y relation out. I am assuming that the SQL is treating these as two different records so it will only display either the x relation or y relation.
I need a work around and do not want use Unions as i would then get two different results.
