Dropdown SQL QUERY duplicates

Hi all,

I have a dropdown bound to this query…

Select_binder is another dropdown.

The query selects the correct row from binder_topics, but it displays it 7 times…

image

The tables are:

binder_names
id
binder_name

binder_topics
id
topic_name
binder_id

Is this an issue with the query (what I am guessing), or maybe something else? 7 times is the exact number of entries in the binder_names table so I am sure this is a query issue.

Thanks for the help,

Steven

I would assume it is your query. I would think it should be more like:

SELECT bt.id
	,bn.topic_name
FROM binder_topics bt
JOIN binder_names bn
	ON bt.id = bn.binder_id
WHERE bn.binder_id = {Root Container.select_binder.selectedValue}
1 Like

Hey Steve,

The Join tells the query how to join. The selected value goes into a WHERE clause. Something like this:

SELECT binder_topics.id, binder_topics.topic_name
FROM binder_topics
JOIN binder_names ON binder_topics.binder_id = binder_names,id
WHERE {Root Container.selectselect_binder.selectedValue} = binder_topics.binder_id

Hope that helps!

Cheers, Sean

@bpreston & @Funguy,

Thank y’all!! I thought there should have been a WHERE clause but was trying to replace the ON. I see now the relationship.

I still have a question on JOINS in general. I understand the relationships of INNER, RIGHT, LEFT, & OUTER, but when you talk about RIGHT & LEFT, how do you define which table is the RIGHT or LEFT table?

is it the FROM table? This has always eluded me and all I read does not seem to really define it.

Again, thanks for the help and education.

Steven

Hey Steve,

The LEFT table is the one after FROM. The RIGHT is one after JOIN.

Cheers, Sean

That's what I was looking for. and its easy to remember going from left to right.

Thanks @Funguy

Steven