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

Missing OR in WHERE #17

Open
Oifan opened this issue Jun 18, 2018 · 1 comment
Open

Missing OR in WHERE #17

Oifan opened this issue Jun 18, 2018 · 1 comment

Comments

@Oifan
Copy link

Oifan commented Jun 18, 2018

Your library is small and effective, but it only allows logical AND in the WHERE clause.
Imagine you need to build a more complex query with several ANDs and ORs -- see these examples: https://www.techonthenet.com/sql/and_or.php .
I took a look at your SelectBuilder class and I see for WHERE clause there is only method and(String) -- how can anyone do more complex queries, like this one?:

SELECT * FROM suppliers
WHERE (state = 'California' AND supplier_id <> 900)
OR (supplier_id = 100);
@s4ibot
Copy link

s4ibot commented Jun 18, 2018

OR is not missing!

Example:
new SelectCreator().column("*").from("suppliers").where(Predicates.or(Predicates.and(Predicates.eq("state", "California"), Predicates.neq("supplier_id", 900)), Predicates.eq("supplier_id", 100)));

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