c# - Re-factor simple SQL statement with WHERE clause -


i feel there must more efficient way this. want allow caller either pull books, or books not hidden (see below)

if isnull(@showhiddenbooks, 0) = 1     begin         select             (long list of fields)                     mytable                     myfield = @somefield     end else     begin         select             (long list of fields)                     mytable                     myfield = @somefield ,             ishidden = 0         end 

any thoughts?

thanks!

select * mytable myfield = @somefield , (ishidden = 0 or @showhiddenbooks = 1) 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -