I want to build a search engine for my website. My database table list is as follows:
d_name
: I need to search on two columns.
If you perform an UNION-query all seperate queries should have the same number of columns in the result. You can use fixed values like NULL
, ''
or 'not provided'
to fill up the other tables.
Examlpe-query (demo)
SELECT column_1, column_2 FROM i_have_two_columns
UNION
SELECT column_1, NULL FROM i_have_only_one_column