I have a table like this
Id Number (string)
1 0000231
2 00232
3 231
4 24
5 A1233
Ex: I need to search by value 23 ( may vary)
Expected Result:
Id Number
1 0000231
2 00232
3 23
Current Ef core search code
Where(c => EF.Functions.Like(c.AIN, $"{filter}%"))
This is getting only 3rd record. Table has Number column which has string. But need to eliminate leading 0’s in like function.
i dont expect answer in Ef. i need Sql query to ]handle effienntly
2
Answers
If you can handle this using raw MySQL, then you could try just casting the column value from text to integer:
In MySQL you can use the
TRIM
function:An alternate would be to use
REGEXP
operator: