Reputation: 65
I've got a table with two columns like
column1 column2
01234 56789
33333 883737
What I need is something like this, but I've no idea how to sql this:
SELECT * FROM table1 WHERE (value1|+|value2)='0123456789'
Any ideas?
Upvotes: 0
Views: 347
Reputation: 5669
Use the CONCAT function, as below:
SELECT *
FROM table1
WHERE CONCAT(column1, column2) = '0123456789';
Reference:
CONCAT function on MySQL Reference Manual
Upvotes: 8
Reputation: 445
Something like
SELECT * FROM table1 WHERE CONCAT(value1,value2)='0123456789'
note, you lose the indexing advantages by using this function. I assumed value1 and value2 are tge column names vs column1 column2.
Upvotes: 0