Reputation: 4189
I currently have a SQL statement where I am trying to filter out certain account numbers. I want all account numbers less than 20000000, is there anyway to write it out using something like
AND ACCT_NO NOT LIKE '2%'
which does not work
Or...should I just use something like this:
AND ACCT_NO < '20000000'
Here is the filter statement:
WHERE adm_date BETWEEN '2012-05-01' AND '2013-04-30'
AND adm_src_desc != 'SCHEDULED ADMISSION'
AND pt_no < '20000000'
AND B_Adm_Source != 'SCHEDULED ADMISSION'
AND B_Pt_No < '20000000'
AND B_Dsch_Date IS NOT NULL
Should I also try something like
and acct < 20000000
without the quotes?
Thank You
Upvotes: 1
Views: 102
Reputation: 1852
This doesn´t work because the first number MAY NOT be a 2. means: Acc No. 2XX (200-299, 20-29 and so on) would not show up.
AND ACCT_NO NOT LIKE '2%'
This would be the right way.
AND ACCT_NO < '20000000'
Upvotes: 3
Reputation: 4189
I ended up using
AND PT_NO < 20000000
AND B_PT_NO < 20000000
This solved the problem.
Upvotes: 1
Reputation: 4101
I want all account numbers less than 20000000
Definitely:
ACCT_NO < 20000000
Upvotes: 3