Re: Query Help

Поиск
Список
Период
Сортировка
От scott.marlowe
Тема Re: Query Help
Дата
Msg-id Pine.LNX.4.33.0310231232480.21690-100000@css120.ihs.com
обсуждение исходный текст
Ответ на Query Help  (yusuf0478@netscape.net)
Список pgsql-sql
On Thu, 23 Oct 2003 yusuf0478@netscape.net wrote:

> I'm interested in finding the minimim A.id such that the following holds:
> 
> select A.charge
>     , B.user_id
>     , C.employee_id
> from A
> inner join B using (user_id)
> inner join C using (employee_id)
> 
> except
> 
> select X.charge
>     , Y.user_id
>     , Z.employee_id
> from X
> inner join Y using (user_id)
> inner join Z using (employee_id)
> 
> --
> 
> I can't do the following, since the number of selected columns have to match: 
> 
> select A.id 
>     , A.charge
>     , B.user_id
>     , C.employee_id
> from A
> inner join B using (user_id)
> inner join C using (employee_id)
> 
> except
> 
> select X.charge
>     , Y.user_id
>     , Z.employee_id
> from X
> inner join Y using (user_id)
> inner join Z using (employee_id)

Maybe you can add a dummy field in the second half like this:

except
select -1     , X.charge    , Y.user_id    , Z.employee_id

???



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

Предыдущее
От: Manuel Sugawara
Дата:
Сообщение: Re: Regular expression problem
Следующее
От: yusuf0478@netscape.net
Дата:
Сообщение: Query Help using Except