Skip to main content
added 390 characters in body
Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"

Or (to avoid trouble with "24H1"),

... WHERE IF(server LIKE "C%", 
             MID(server, 2) BETWEEN 89 AND 110,
             FALSE)

Oh, now I see another 'bad' server name (INT1). Face it, you need to put some of the burden on the DBA. He must realize that the practical way is to say

... WHERE server BETWEEN 'C89'  AND 'C99'
       OR server BETWEEN 'C100' AND 'C110'

That is, break up the filtering into as many ranges as needed so that string comparisons will work, and do not think numeric.

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"

Or (to avoid trouble with "24H1"),

... WHERE IF(server LIKE "C%", 
             MID(server, 2) BETWEEN 89 AND 110,
             FALSE)

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"

Or (to avoid trouble with "24H1"),

... WHERE IF(server LIKE "C%", 
             MID(server, 2) BETWEEN 89 AND 110,
             FALSE)

Oh, now I see another 'bad' server name (INT1). Face it, you need to put some of the burden on the DBA. He must realize that the practical way is to say

... WHERE server BETWEEN 'C89'  AND 'C99'
       OR server BETWEEN 'C100' AND 'C110'

That is, break up the filtering into as many ranges as needed so that string comparisons will work, and do not think numeric.

added 155 characters in body
Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"

Or (to avoid trouble with "24H1"),

... WHERE IF(server LIKE "C%", 
             MID(server, 2) BETWEEN 89 AND 110,
             FALSE)

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"

Or (to avoid trouble with "24H1"),

... WHERE IF(server LIKE "C%", 
             MID(server, 2) BETWEEN 89 AND 110,
             FALSE)
added 138 characters in body
Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

A shorter answer:

... WHERE MID(server, 2) BETWEEN 89 AND 110

Or, if you need to limit to the "C" set of servers:

... WHERE MID(server, 2) BETWEEN 89 AND 110
      AND server LIKE "C%"
Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117
Loading