Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condition on multiple tables #64

Closed
cdxf opened this issue Oct 22, 2021 · 1 comment
Closed

Condition on multiple tables #64

cdxf opened this issue Oct 22, 2021 · 1 comment
Assignees

Comments

@cdxf
Copy link

cdxf commented Oct 22, 2021

Is your feature request related to a problem? Please describe.

For now, Jailer only allow me to restrict the dataset on the main table, if I set condition on the related table, it only hide other records on this particular table and other sub tables (perform the condition on the ON clause), what I want is to hide other records from the main table and other tables also (perform the condition on the WHERE clause)
Assume I have 2 tables: EMPLOYEE (main table) and EMPLOYEE_COUNTRY (related table)
Now if I want to find all the employee with a particular name and country, I can't do this.
The correct query I want is:

SELECT * FROM EMPLOYEE 
LEFT JOIN EMPLOYEE_COUNTRY 
ON EMPLOYEE.ID = EMPLOYEE_COUNTRY.ID 
WHERE EMPLOYEE.NAME = ? AND EMPLOYEE_COUNTRY.NAME = ?

But what Jailer is doing:

SELECT * FROM EMPLOYEE 
LEFT JOIN EMPLOYEE_COUNTRY 
ON (EMPLOYEE.ID = EMPLOYEE_COUNTRY.ID AND AND EMPLOYEE_COUNTRY.NAME = ?)
WHERE EMPLOYEE.NAME = ? 

Describe the solution you'd like

-To have another panel for global WHERE, not just condition for joining.

  • Or to have another textbox on tables for WHERE condition

Describe alternatives you've considered

I can use 'Start Navigation Here' to turn sub table into main table but it only accept conditions on main table only, what I want is conditions on multiple tables.

Additional context

@cdxf cdxf changed the title Condition on multiple tables? Condition on multiple tables Oct 22, 2021
@Wisser
Copy link
Owner

Wisser commented Oct 24, 2021

I can use 'Start Navigation Here' to turn sub table into main table but it only accept conditions on main table only, what I want is conditions on multiple tables.

This is not quite true. Whether tables are connected with inner or outer joins depends on which table you apply the "Query Builder" or "SQL Console" menu item to.
Tables to the left of it (the predecessors) are joined with an inner join, those to the right (successors) with an outer join.

As a general rule, you will see exactly those rows in the SQL Console that are also visible in the browser window in which you apply this menu item.

@Wisser Wisser self-assigned this Oct 24, 2021
@Wisser Wisser closed this as completed Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants