Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Parsing out values from WHERE and removing it from WHERE clause #1577

AStvnMC started this conversation in General
Discussion options

Hello,
I was wondering if there is a way to remove some target strings from the WHERE clause and create a new SELECT that does not contain the target strings.

For Example:
SELECT * FROM table WHERE date > 0 AND start = '2022' AND end = '2023';

Wanted Output:
SELECT * FROM table WHERE date > 0;

And I would want to be able to obtain the start and end values and store it myself.

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Bump

You must be logged in to vote
0 replies
Comment options

Maybe this helps: https://stackoverflow.com/questions/57055443/how-to-add-where-condition-to-sql-with-jsqlparser. The parser gives you a statement object you could traverse by your own. So dependent of the structure of this where statement you can naturally read out those start / end values.

You must be logged in to vote
1 reply
Comment options

Thanks I did end up traversing the tree haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /