Re: query from two tables & concat the result

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: query from two tables & concat the result
Дата
Msg-id 56B2082D.9090404@iol.ie
обсуждение исходный текст
Ответ на Re: query from two tables & concat the result  (arnaud gaboury <arnaud.gaboury@gmail.com>)
Ответы Re: query from two tables & concat the result  (arnaud gaboury <arnaud.gaboury@gmail.com>)
Список pgsql-general
On 03/02/2016 13:57, arnaud gaboury wrote:
> On Wed, Feb 3, 2016 at 2:19 PM, Raymond O'Donnell <rod@iol.ie> wrote:
>> On 03/02/2016 13:11, arnaud gaboury wrote:
>>
>>> Hum hum...
>>> ------------------------------------------------------
>>> SELECT u.username ||'@'||d.domain as email_address
>>> FROM email.mailusers u
>>> INNER JOIN
>>> email.domain d
>>> ON
>>> (u.domain_id=d.domain.id)
>>> WHERE id=1;
>>>
>>> ERROR:  missing FROM-clause entry for table "domain"
>>> LINE 6: (u.domain_id=d.domain.id)
>>> --------------------------------------------------------------
>>>
>>> What did I wrong following your solution?
>>
>> In the join condition, replace "d.domain.id" with "d.id" (partly my
>> mistake, I missed that the column is called "id" and not "domain_id" in
>> the domains table).
>>
>> Ray.
>
> I noticed your mistake but made a wrong change myself :-(
> Now working perfectly:
>
> thetradinghall=> SELECT u.username ||'@'||d.domain as email_address
> FROM email.mailusers u
> INNER JOIN
> email.domainlist d
> ON
> (u.domain_id=d.id);
>
>            email_address
> -----------------------------------
>  arnaud.gaboury@thetradinghall.com
> (1 row)
> -------------------------------------
>
> As for the cleaning of ID, I dropped id and changed both primary keys.
> Thank you so much for your prompt answer and help.

You're very welcome - glad to be able to help.

R.


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


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

Предыдущее
От: arnaud gaboury
Дата:
Сообщение: Re: query from two tables & concat the result
Следующее
От: arnaud gaboury
Дата:
Сообщение: Re: query from two tables & concat the result