Hi everyone,
I am new to this board. I am trying to figure out how to set up an SQL statement to grab a record from a database when I'm not sure what column/field the string I am looking for will be in. for instance:
I am looking for "ABCDEFG", but it could be in column1 or column2 or column3.

Thanks!

Deanna

Recommended Answers

All 3 Replies

Create a view based on concatenated value of all the columns and run the search on that view instead of the table.

I don't understand. I need to know how to write the SQL statement.

try to create a view like this

create view view_name as select col || col2 || col3 as concat_column from table_name

and run the search on the concat_column of view_name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.