IMHO.WS

IMHO.WS (https://www.imho.ws/index.php)
-   Веб-программирование (https://www.imho.ws/forumdisplay.php?f=29)
-   -   поиск в MySql (https://www.imho.ws/showthread.php?t=41002)

plohich 15.10.2003 13:36

поиск в MySql
 
как делать запрос в мускул чтоб из таблицы все строки у которых в 'name' содержиться буква 'e'?
есть возможность сделать продвинутый запрос с ' * ' и ' ? ' ?
спасибо за помощь!

RaZEr 15.10.2003 13:44

RTFM - 6.8 MySQL Full-text Search

plohich 15.10.2003 14:24

RaZEr
а че это такое? мне бы просто как правильно query написать!

RaZEr 15.10.2003 14:28

Там есть пример запроса.

plohich 15.10.2003 16:45

а где его можно взять?

RaZEr 15.10.2003 16:49

Кого его ? мануал ? на mysql.org

Stasik 15.10.2003 17:14

SELECT * FROM table WHERE name LIKE '%e%'

plohich 15.10.2003 18:02

Stasik
спасибо! это и надо было! а можно опциональность с ' * ' и ' ? ' добавить?

RaZEr 15.10.2003 18:04

В LIKE - нет. Юзай то, что я предложил ...

Stasik 16.10.2003 01:16

RTFM - * и есть "%"

RaZEr 16.10.2003 06:56

* это, как я понимаю, - квантификатор рег. выражений. И если % чему и аналогичен, то (.*) . Тоже касается и "_" ... аналогичного (.?) ... поэтому если нужно повторить функциональность "*" и "?", то только - ф-ия REGEXP. Но я бы использовал "MySQL Full-text Search", который тоже умеет немало:
Цитата:

+
A leading plus sign indicates that this word must be present in every row returned.

-
A leading minus sign indicates that this word must not be present in any row returned.
By default (when neither plus nor minus is specified) the word is optional, but the rows that contain it will be rated higher. This mimicks the behaviour of MATCH() ... AGAINST() without the IN BOOLEAN MODE modifier.

< >
These two operators are used to change a word's contribution to the relevance value that is assigned to a row. The < operator decreases the contribution and the > operator increases it. See the example below.

( )
Parentheses are used to group words into subexpressions.

~
A leading tilde acts as a negation operator, causing the word's contribution to the row relevance to be negative. It's useful for marking noise words. A row that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator.

*
An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended.

"
The phrase, that is enclosed in double quotes ", matches only rows that contain this phrase literally, as it was typed.
PS: Конечно не рег. выражения, но для организации поиска по сайту - самое то.

plohich 16.10.2003 12:04

RaZEr
спасибо! то что надо! мне кажется, после такого, можно и тему закрыть! :)


Часовой пояс GMT +4, время: 09:08.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.