mcfc4heatons Posted July 12, 2021 Share Posted July 12, 2021 hi, How does one one write multiple conditional WHERE clauses where any values that are null are not part of the query Like this but where each one is only part of the where clause if the value is not null SELECT * FROM table WHERE col1 = ? AND col2 = ? AND col3 = ? AND col4 = ? Quote Link to comment Share on other sites More sharing options...
requinix Posted July 12, 2021 Share Posted July 12, 2021 So for each of those columns, you want it to be that the column IS NULL OR the column = some value? Quote Link to comment Share on other sites More sharing options...
Barand Posted July 12, 2021 Share Posted July 12, 2021 I am wondering if @mcfc4heatons is is really referring to NULL values occuring as the result of a LEFT JOIN, in which case putting the conditions in a WHERE clause does not work - they need to be in the JOIN .. ON conditions Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.