Форум: "Базы";
Текущий архив: 2003.07.21;
Скачать: [xml.tar.bz2];
ВнизФильтрация по не полному совпадению строк. Найти похожие ветки
← →
Jackal22 (2003-06-26 13:19) [0]Ув. МАСТЕРА, помогите плззззззз.
Есть текстовое поле в табличке, нужно отобрать все записи начинающиеся, например, на "Зав".
Заранее благодарен за помощь.
← →
Карелин Артем (2003-06-26 13:31) [1]Я это делаю на SQl с помощью Select ... where ... Like "Зав%"
← →
Jackal22 (2003-06-26 13:34) [2]Я так понимаю что % это анлог *?
← →
Карелин Артем (2003-06-26 16:23) [3]Jackal22 © (26.06.03 13:34)
Ну типа того.
The wildcard substitution character ("%") may be used in the comparison to represent an unknown number of characters. LIKE returns a TRUE when the portion of the column value matches that portion of the comparison value not corresponding to the position of the wildcard character. The wildcard character can appear at the beginning, middle, or end of the comparison value (or multiple combinations of these positions). For example, the statement below retrieves rows where the column value begins with "A" and is followed by any number of any characters. Matching values could include "Action Club" and "Adventure Undersea", but not "Blue Sports".
SELECT *
FROM customer
WHERE (company LIKE "A%")
The single-character substitution character ("_") may be used in the comparison to represent a single character. LIKE returns a TRUE when the portion of the column value matches that portion of the comparison value not corresponding to the position of the single-character substitution character. The single-character substitution character can appear at the beginning, middle, or end of the comparison value (or multiple combinations of these positions). Use one single-character substitution character for each character to be wild in the filter pattern For example, the statement below retrieves rows where the column value begins with "b" ends with "n", with one character of any value between. Matching values could include "bin" and "ban", but not "barn".
SELECT words
FROM dictionary
WHERE (words LIKE "b_n")
Use NOT to return the converse of a LIKE comparison.
Use ESCAPE when the wildcard character "%" or "_" appear as data in the column. The ESCAPE keyword designates an escape character. In the comparison value for the LIKE predicate, the character that follows the escape character is treated as a data character and not a wildcard character. Other wildcard characters in the comparison value are unaffected.
In the example below, the "^" character is designated as the escape character. In the comparison value for the LIKE predicate ("%10^%%"), the "%" that immediately follows the escape character is treated as data in the PercentValue. This allows filtering based on the string "10%".
SELECT *
FROM Sales
WHERE (PercentValue LIKE "%10^%%" ESCAPE "^")
LIKE can be used only with CHAR or compatible data types. If one value is of an incompatible data type, convert that value with the CAST function to a compatible data type. The comparison performed by the LIKE predicate is case-sensitive.
Страницы: 1 вся ветка
Форум: "Базы";
Текущий архив: 2003.07.21;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.007 c