SQL On Dropdowns

Theodoulos Iacovou asked on September 17, 2020 15:45

Hello guys,

I want know how to add an input(field) on sql query.

---QUERY---- IF THIS input IS NULL THEN SELECT ...

Thank you

Recent Answers


Brenden Kehren answered on September 17, 2020 16:03

You'd want to use a UNION statement.

select '', '-- select one --'
union
select [ValueColumn], [NameColumn]
from custom_table
where [enabled] = 1
order by 2
0 votesVote for this answer Mark as a Correct answer

Theodoulos Iacovou answered on September 17, 2020 16:17

Thank you Brenden Kehren for your Answer.

But I want to check,

If this input(field of a form) is null then execute the select.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.