Reputation: 17393
In my table I have a column that contains a random values. They have a regular structure like below :
id | value ---------------- 1 | 1_426_7894(245) 2 | 4_463_9654(465) 3 | 3_954_3678(465) 4 | 9_356_5412(157) 5 | 5_986_3578(987) 6 | 2_125_4689(749) 7 | 8_286_7859(879)
value1_value2_value3(value4)
now,I would like to search in this table where value3 is 3678. Is it possible to make this query ? or PHP should help me ?
Upvotes: 0
Views: 2180
Reputation: 1912
Search table where value3 is 3678
select * from
table_name
where INSTR(value,concat("_",3678,"(")>0;
Upvotes: 0
Reputation: 980
Maybe you can do something like that ?
DECLARE @variable varchar(max)
SET @variable = '3678'
SELECT * FROM <table> WHERE variable1 like '%_' + '%_'+ @variable + '(%)'
Upvotes: 0