Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

WHERE "OR" HAVING Conditions instead of "AND"

i want to run sql query (mysql) and i have multiple condition in WHERE & also multiple condition in HAVING,
SQL apply "AND" between WHERE & HAVING, i want to apply "OR" between.

WHERE Condition 1, Condition 2 …. Condition N
{{OR}}
HAVING Condition 1, Condition 2 …. Condition N

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The only option that I can see to solve your problem is to separate de query and apply UNION DISTINCT to remove the duplicated results. The solution could be something like:

SELECT * FROM t1 WHERE ...

UNION DISTINCT

SELECT * FROM t1 HAVING ...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading