MySQL Forums
Forum List  »  Newbie

Skip part of where statement
Posted by: Todd Lane
Date: April 27, 2018 03:01PM

Hi,

Is there a way of skipping part of a where statement if there is no entry?

For example if I have a form with 3 fields but field a has no entry therefore it is skipped.

In other words form has fields

ColumnA with an entry of blah
ColumnB with an entry of 1
Column C with an entry of 10

so sql statement that fires is select * from table a where ColumnA = 'blah' and ColumnB = 1 and ColumnC = 10

but if there was no entry in the ColumnA field the effective statement that is run is select * from table a where ColumnB = 1 and ColumnC = 10

Its not a point of looking for null or blank values, if a value isn't passed then that part of the where statement is skipped.

Thanks in advance.

Todd

Options: ReplyQuote


Subject
Written By
Posted
Skip part of where statement
April 27, 2018 03:01PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.