Hello experts. I have attached a document for illustration as well. You can see in the attachment my first query with multiple joins is working correctly and returning two test records per the parameters I gave it. The last table I want to join is a table called stock_quant. Below is the sql which returns two records that you can also see in my attachment. The problem I am having is when I attempt to join this last table instead of the two records getting added to my original two records, I get a ton of duplicated data. Hoping someone can take a look at give me the proper syntax in my join as to what I am missing. Thanks ahead of time from a newbie
test_example.docxtest_example.docxselect * from stock_quant
where product_id = '15448'
and location_id in ('16', '28', 99)
test_example.docx
Your SQL statement at the end of the post raises some serious questions.
1) Check your data types. ID values are normally integer, not string, thus using quotes is not necessary. It creates an query compilation overhead for the necessary type casts.
2) Don't mix data types in the literal list of the IN predicate. Either location_id is integer, then all values must be integer or it is string, then all values must be quoted.
3) A table for storing only quantities sounds like a flawed data model as you modeled the relation as an attribute.