Re: SELECT question (splitting a field)

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: SELECT question (splitting a field)
Дата
Msg-id 46DDBC25.4040003@archonet.com
обсуждение исходный текст
Ответ на Re: SELECT question (splitting a field)  (Madison Kelly <linux@alteeve.com>)
Список pgsql-general
Madison Kelly wrote:
> SELECT 'Y' AS local FROM domains d, users u WHERE u.usr_dom_id=d.dom_id
> AND u.usr_email||'@'||d.dom_name IN ('mkelly@test.com');
>
> Though this may not be the most efficient. In my case, the 'usr_email'
> is the LHS of the '@' sign and 'dom_name' is the domain name. If I
> wanted to use (I)LIKE, how would I have matched just the domain section
> of 'mkelly@test.com' in 'dom_name'?

Something like:

SELECT ... FROM domains d WHERE ('%@' || d.dom_name) LIKE 'mkelly@test.com';

--
   Richard Huxton
   Archonet Ltd

В списке pgsql-general по дате отправления:

Предыдущее
От: Madison Kelly
Дата:
Сообщение: Re: SELECT question (splitting a field)
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: UTF8 frustrations