Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Как связать 2 запроса [D7, XP]


031178 ©   (2008-04-03 14:01:00) 

Подскажите мастера, можно как нибудь связать вот эти 2 запроса в один !!

Select * from Kontakt where exists (select null from NS where (NS._ID = Kontakt._Num)and(NS._Name='111'))

Select * from Kontakt where exists (select null from Interes where (Interes._ID = Kontakt._Num)and(Interes._Pozic='222'))


clickmaker   (2008-04-03 14:48:00) [1]

вот кто ВКонтактеРу пишет ))


Sergey13   (2008-04-03 14:19:00) [2]

> [9] 031178   (03.04.08 14:15)
> Select * from Kontakt where exists (select null from NS
> where (NS._ID = Kontakt._Num)and(NS._Name='111'))
>
> Select * from Kontakt where exists (select null from Interes
> where (Interes._ID = Kontakt._Num)and(Interes._Pozic='222')
> )

Select * from Kontakt where exists (select null from NS where (NS._ID = Kontakt._Num)and(NS._Name='111'))
UNION
Select * from Kontakt where exists (select null from Interes where (Interes._ID = Kontakt._Num)and(Interes._Pozic='222'))

Или попробовать
Select * from Kontakt where (exists (select null from NS where (NS._ID = Kontakt._Num)and(NS._Name='111')))
                        or (exists (select null from Interes where (Interes._ID = Kontakt._Num)and(Interes._Pozic='222')))


031178   (2008-04-03 14:18:00) [3]

Игорь Шевченко, спасибо !!!


Игорь Шевченко   (2008-04-03 14:16:00) [4]


> Select * from Kontakt where exists (select null from NS
> where (NS._ID = Kontakt._Num)and(NS._Name='111'))
>
> Select * from Kontakt where exists (select null from Interes
> where (Interes._ID = Kontakt._Num)and(Interes._Pozic='222'))


Select * from Kontakt where exists (select null from NS
 where (NS._ID = Kontakt._Num)and(NS._Name='111'))
or exists (select null from Interes
 where (Interes._ID = Kontakt._Num)and(Interes._Pozic='222'))

?


Johnmen   (2008-04-03 14:16:00) [5]

Последняя попытка:
ЧТО ЗНАЧИТ "СВЯЗАТЬ"?


Игорь Шевченко   (2008-04-03 14:15:00) [6]

Обоим надо связать ? Или кому-то одному ?


031178   (2008-04-03 14:15:00) [7]

Я вроде нормально спросил, может кто нибудь помочь связать 2 запроса в один ?

Select * from Kontakt where exists (select null from NS where (NS._ID = Kontakt._Num)and(NS._Name='111'))

Select * from Kontakt where exists (select null from Interes where (Interes._ID = Kontakt._Num)and(Interes._Pozic='222'))


clickmaker   (2008-04-03 14:14:00) [8]

where <cond1> or <cond2>
еще есть join


Плохиш   (2008-04-03 14:12:00) [9]


> Или лучше дискуссировать будем ?

Лучше ветку закрыть, т.к. помочь кому-то не знающему, что оно хочет получить, не представляется возможным.


031178   (2008-04-03 14:09:00) [10]

Johnmen , можешь подсказать ? Или лучше дискуссировать будем ?


Johnmen   (2008-04-03 14:06:00) [11]


> Лучше конечно правильно !!!

Что значит "правильная связка"? Это как?

А может как то по другому можно условие задать ?

Ага. Вопрос надо по-другому задавать.


031178   (2008-04-03 14:04:00) [12]

Лучше конечно правильно !!! А может как то по другому можно условие задать ?


Armond   (2008-04-03 14:03:00) [13]

да честно сказать, просто чтобы работал !!!


Johnmen   (2008-04-03 14:02:00) [14]


>  можно как нибудь связать

Тебе правильно надо связать или как-нибудь?


Наверх

Титульная страница Поиск, карта сайта Написать письмо