2012-07-30 96 views
2

我正在填充下拉列表中的所有用戶名。我想忽略包含這些#,\, /, uppercase, $中的任何一個的用戶名。我正在執行此查詢,但仍會顯示\的記錄,例如ad \ name。

select account_name from dba_account where CAST(account_name AS BINARY) RLIKE '[a-z]' 
and account_name not like '%#%' and account_name not like '%$%' and account_name not like 
'%/%' limit 50; 

任何建議????

謝謝你......

回答

2
SELECT 
    account_name 
FROM 
    dba_account 
WHERE 
    CAST(account_name AS BINARY) RLIKE '[a-z]' 
    AND account_name NOT RLIKE '[#$\\\\/]' 
LIMIT 50; 
+0

嘿它仍然顯示該記錄:廣告\名稱 – ashah142 2012-07-30 16:07:34

+0

@Aashil您確定您使用的是正確的查詢嗎?我在一分鐘前對答案做了修改。再試一次。 – Tomalak 2012-07-30 16:10:13

+0

是的...它仍然顯示..我不明白爲什麼...它也顯示記錄與'#'.. – ashah142 2012-07-30 16:36:34

0

您的查詢

select account_name from dba_account where CAST(account_name AS BINARY) RLIKE '[a-z]' and account_name not like '%#%' and account_name not like '%$%' and account_name not like '%/%' limit 50; 

不包含邏輯排除反斜槓。