Question: I connected to database in my java program. I have a situation where I need to pass filter values dynamically, filter values depends of others parts of java code

Example query: select \* from table1 where id in (dynamic and multiple)?

How to pass these dynamic and multiple values using Java connection.

Answer: 
Yes, you will need an intermediate table if there are multiple soups per day.
You can goup all the soups for a day using `GROUP_CONCAT` in the `SELECT` statement.

<http://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html#function_group-concat>

```
SELECT ma.id, ma.day, GROUP_CONCAT(DISTINCT so.soup) as soup
FROM main ma
LEFT JOIN soupmain sm ON(ma.id = sm.id_main)
LEFT JOIN soup so ON(so.id = sm.id_soup)
WHERE ma.id = 1
GROUP BY ma.id

```
You can use a group\_concat

```
SELECT ma.day,  groupconcat(so.soup)
FROM main ma, soup so
WHERE ma.id_soup = so.id
AND ma.id = 1
group by ma.day

```