Re: Help on SQL query

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: Help on SQL query
Дата
Msg-id 951259bf-280d-ce6d-7493-cdbb628074f0@gmail.com
обсуждение исходный текст
Ответ на Re: Help on SQL query  (Ian Tan <iantan1268@gmail.com>)
Список pgsql-sql
On 2/15/19 11:16 AM, Ian Tan wrote:
> Hello Andrew,
> Thank you, I appreciate your response and your help.
>
> Hello Rob,
> I learn in my own time and had no one to ask. If pgsql-sql is not the
> correct forum for these kinds of question, kindly let me know.
>
> Thank you.
>
> Regards,
> Ian
>
> On Fri, 15 Feb 2019 at 17:38, Rob Sargent <robjsargent@gmail.com> wrote:
>>
>>
>>> On Feb 15, 2019, at 10:28 AM, Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
>>>
>>>>>>>> "Ian" == Ian Tan <iantan1268@gmail.com> writes:
>>> Ian> How do I write an SQL query so that the "name" text in car_parts
>>> Ian> are added to the bill_of_materials table, so that it looks like
>>> Ian> this:
>>>
>>> The only trick with this is that you need to join the car_parts table
>>> twice (once for parent and once for child), and to do that you need to
>>> give it different alias names:
>>>
>>> select bom.parent_id,
>>>        ppart.name as parent_name,
>>>        bom.child_id,
>>>        cpart.name as child_name
>>>   from bill_of_materials bom
>>>   join car_parts ppart on (ppart.id=bom.parent_id)
>>>   join car_parts cpart on (cpart.id=bom.child_id);
>>>
>>> --
>>> Andrew (irc:RhodiumToad)
>>>
>> Andrew, will you do my homework too?

My apologies.  It looked suspiciously like a homework question to me.




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

Предыдущее
От: Ian Tan
Дата:
Сообщение: Re: Help on SQL query
Следующее
От: "Campbell, Lance"
Дата:
Сообщение: Group By aggregate string function