|
|
|
Помогите с SQL запросом, а именно с работой like
|
|||
|---|---|---|---|
|
#18+
Помогите с SQL запросом, а именно с работой like Необходимо написать запрос типа: select * from DataBase where Data like ... Я понял что следующие структуры в like под Oracle работают: '%' '%<любой символ>' '%<любой символ>%' '<любой символ>%' '<любое слово>%' и т.д. Но мне надо выбрать все строки в которых Data начинается не только, например с символа 'A', но еще и снекоторых других, например 'C' и 'E', но следующая структура: ... Data like '[ACE]%' НЕ РАБОТАЕТ Или наоборот требуется, чтобы Data не начиналась, например, с этих же символов... ... Data like '[!ACE]%' или ... Data like '[^ACE]%' тоже не работают... Помогите, пожалуйста разобраться, Спасибо. PS: Ответ можно как на e-mail, так и здесь в форуме... Еще раз СПАСИБО ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 26.02.2003, 19:06 |
|
||
|
Помогите с SQL запросом, а именно с работой like
|
|||
|---|---|---|---|
|
#18+
General Examples This condition is true for all last_name values beginning with "Ma": last_name LIKE 'Ma%' All of these last_name values make the condition true: Mallin, Markle, Marlow, Marvins, Marvis, Matos Case is significant, so last_name values beginning with "MA", "ma", and "mA" make the condition false. Consider this condition: last_name LIKE 'SMITH_' This condition is true for these last_name values: SMITHE, SMITHY, SMITHS This condition is false for 'SMITH', since the special character "_" must match exactly one character of the lastname value. ESCAPE Clause Example You can include the actual characters "%" or "_" in the pattern by using the ESCAPE clause, which identifies the escape character. If the escape character appears in the pattern before the character "%" or "_" then Oracle interprets this character literally in the pattern, rather than as a special pattern matching character. To search for employees with the pattern 'A_B' in their name: SELECT last_name FROM employees WHERE last_name LIKE '%A\_B%' ESCAPE '\'; The ESCAPE clause identifies the backslash (\) as the escape character. In the pattern, the escape character precedes the underscore (_). This causes Oracle to interpret the underscore literally, rather than as a special pattern matching character. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 26.02.2003, 19:36 |
|
||
|
Помогите с SQL запросом, а именно с работой like
|
|||
|---|---|---|---|
|
#18+
Как один из вариантов: where substr(data,1,1) in ('A','B') и наоборот substr(data,1,1) not in ('A','B') ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 26.02.2003, 20:29 |
|
||
|
Помогите с SQL запросом, а именно с работой like
|
|||
|---|---|---|---|
|
#18+
Where Data LIKE '%A%B%C%'... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.02.2003, 05:08 |
|
||
|
|

start [/forum/topic.php?fid=52&msg=32111814&tid=1991690]: |
0ms |
get settings: |
6ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
159ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
30ms |
get tp. blocked users: |
1ms |
| others: | 225ms |
| total: | 443ms |

| 0 / 0 |
