Answer the question
In order to leave comments, you need to log in
How to find a similar string in SQL?
There is such a table:
id param1 param2 param3....
1 1 1 1
2 1 1 1
3 1 1 1
4 2 1 1
5 2 1 1
It is necessary to return the following row by id=1 id=2,3
by id=4 return line id=5.
Of course, you can save all the params to an array and do this:
SELECT param1, param2, param3 FROM table WHERE id=1;
SELECT * FROM table WHERE [email protected] and [email protected] and [email protected];
Answer the question
In order to leave comments, you need to log in
You can try to join the table on itself and compare CONCAT.
Didn't check but the logic is clear
Or:
SELECT * FROM table as a JOIN table as b ON a.param1 = b.param1 AND a.param2 = b.param2 AND a.param3 = b.param3 WHERE a.id = '1';
SELECT * FROM table WHERE param1 = (SELECT param1 FROM table WHERE id=1) AND param2 = () ....
Also not the most elegant solution, really)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question