Select data in mysql where delimiters are two data alphanumeric data fields
My Table structure have two Columns, One for start range and another for End of Range. Both are alphanumeric. I have to search a row according to user input, a Alphanumeric string.
like : SELECT form table where range1 <= 'user_input' and range2 >= 'user_input';
But range1, range2 and user_input are alphanumeric values (Barcodes).
range1 and range2 are alphanumeric numbers generated by some php function in a series.
like for range1 156WB562789 and range开发者_StackOverflow2 156WB562880
range1 and range2 have change in last 3 chars (which are numbers) only remain all are same.
If your barcode has always the same structure ([0-9]{3}[A-Z]{2}[0-9]{5}
) you can split it into 3 cols (part1
part2
part3
) and then split user's string and make a query that will operate with that three cols.
It is not optimal solution but I have no other right now.
精彩评论