how to select numbers (integers) only?
-
Hi, I have employee_number field which has employee_numbers like this: 12 434 ABC345 QWR-567 I want to know how can I just select the numeric values to perform a MAX on it? so ABC345 and QWR-567 will not be considered in the SELECT
Technology News @ www.JassimRahma.com
-
Hi, I have employee_number field which has employee_numbers like this: 12 434 ABC345 QWR-567 I want to know how can I just select the numeric values to perform a MAX on it? so ABC345 and QWR-567 will not be considered in the SELECT
Technology News @ www.JassimRahma.com
-
Hi, I have employee_number field which has employee_numbers like this: 12 434 ABC345 QWR-567 I want to know how can I just select the numeric values to perform a MAX on it? so ABC345 and QWR-567 will not be considered in the SELECT
Technology News @ www.JassimRahma.com
-
Hi, I have employee_number field which has employee_numbers like this: 12 434 ABC345 QWR-567 I want to know how can I just select the numeric values to perform a MAX on it? so ABC345 and QWR-567 will not be considered in the SELECT
Technology News @ www.JassimRahma.com
Some guidance on the database you are using would be useful. Take a look at the ISNUMERIC keyword in BOL.
Never underestimate the power of human stupidity RAH
-
Hi, I have employee_number field which has employee_numbers like this: 12 434 ABC345 QWR-567 I want to know how can I just select the numeric values to perform a MAX on it? so ABC345 and QWR-567 will not be considered in the SELECT
Technology News @ www.JassimRahma.com
WHERE id NOT LIKE '%[a-z]%'
will eliminate any with alphabetic characters, that's a start, work from there.You'll never get very far if all you do is follow instructions.
-
WHERE id NOT LIKE '%[a-z]%'
will eliminate any with alphabetic characters, that's a start, work from there.You'll never get very far if all you do is follow instructions.
I tried this:
SELECT employee_number FROM employees WHERE employee_number REGEXP ('[0-9]');
it's working excellent and I getting these numbers 7, 8, 9, 11, 1.222, 12, 13, 9, 15, 9, 9, 9 BUT.... when I run:
SELECT MAX(employee_number) FROM employees WHERE employee_number REGEXP ('[0-9]');
I get 9 where i should get 15. why is that?
Technology News @ www.JassimRahma.com
-
I tried this:
SELECT employee_number FROM employees WHERE employee_number REGEXP ('[0-9]');
it's working excellent and I getting these numbers 7, 8, 9, 11, 1.222, 12, 13, 9, 15, 9, 9, 9 BUT.... when I run:
SELECT MAX(employee_number) FROM employees WHERE employee_number REGEXP ('[0-9]');
I get 9 where i should get 15. why is that?
Technology News @ www.JassimRahma.com
Because they're strings; you'll need to convert to numeric fo rthe comparisons to work the way you want.
You'll never get very far if all you do is follow instructions.