Apologies if this is a duplicate question but I was unable to find the correct result but that could be down to the phrasing of my question but here goes.
I have a table with BIGINT primary keys. I have a search facility which primarily will search for a primary key from a barcode with a string prefix.
So my search takes the prefix matches it to the target table, strips the prefix and searches - works great. But users can also search for secondary values like order references etc.
One such contains Amazon order references like 204-5032532-4220. The search is designed to look in the ID column first where id=reference, and if that doesn't return any results it will move on to searching a series of seconday columns with the value.
However what I am seeing is the first query:
select * from `table` where `id` = '202-955552-9066709';
Is returning row id= the first part of the reference before the first - so in this example I get row id = 202.
Am I missing something fundamental in the way MySQL works - is it treating my value as INT because the column is numeric? I can obviously change the logic of my code, detect if the barcode matches otherwise don't check the value against the id but this seems to me to be strange behaviour?
I'm using 8.0.44.