Subject RE: [firebird-support] Re: Help
Author Roger Vellacott
But be careful. This will only work if....

No numbers begin with 0
All strings involved are numeric

In the case of credit card numbers, this is probably a reasonable

You are also assuming that Firebird will cast bin_num as a number for
"Max(bin_num)" and as a string for "Starting with bin_num". Otherwise 99
could well be seen as greater than 1000. Is this a reliable assumption?

Roger Vellacott

> > Assuming bin_table/bin_num hold the bin numbers, and search_bin is
> > the value for which you try to find the best match, try:
> >
> > SELECT MAX(bin_num) FROM bin_table WHERE :search_bin STARTING WITH
> > bin_num
> This looks like the simplest and best solution so far!

[Non-text portions of this message have been removed]