|
SQL-gurus, помогите с запросом, плиз! (JOINs)
|
|||
---|---|---|---|
#18+
Народ! Помогите, кто может, сами мы не местные... ;-) Есть у меня запрос, под Ораклом писаный, где в FROM стоит вот что: FROM creditor creditor, itembatch itembatch, itementry itementry WHERE itembatch.inventorynumber = itementry.inventorynumber AND itembatch.itembatchnumber = itementry.itembatchnumber AND itembatch.itemnumber = itementry.itemnumber AND itementry.vouchernumber = :new.vouchernumber AND itementry.thesuppliernumber = creditor.creditornumber (+) AND itementry.movementdirection=1 А вот под DB2 я что-то никак сообразить не могу, как его с JOIN-ами переписать... :-(( ... |
|||
:
Нравится:
Не нравится:
|
|||
29.12.2003, 14:42 |
|
SQL-gurus, помогите с запросом, плиз! (JOINs)
|
|||
---|---|---|---|
#18+
Да можно и так оставить, имея объединение таблиц в WHERE, а можно с join, но только что это - creditor.creditornumber (+) Я вот не знаю что это (+) значит ... |
|||
:
Нравится:
Не нравится:
|
|||
29.12.2003, 17:15 |
|
SQL-gurus, помогите с запросом, плиз! (JOINs)
|
|||
---|---|---|---|
#18+
этот (+) в Оракле означает что там, где он, (+), указан, в таблице может не иметься строки, соответствующей условию, т.е. это как раз и есть один из вариантов OUTER JOIN... ... |
|||
:
Нравится:
Не нравится:
|
|||
29.12.2003, 17:31 |
|
SQL-gurus, помогите с запросом, плиз! (JOINs)
|
|||
---|---|---|---|
#18+
Примерно что-то типа... Select * FROM creditor creditor, itembatch itembatch RIGHT OUTER JOIN itementry itementry ON itementry.thesuppliernumber = creditor.creditornumber WHERE itembatch.inventorynumber = itementry.inventorynumber AND itembatch.itembatchnumber = itementry.itembatchnumber AND itembatch.itemnumber = itementry.itemnumber AND itementry.vouchernumber = :new.vouchernumber AND itementry.movementdirection=1 ... |
|||
:
Нравится:
Не нравится:
|
|||
29.12.2003, 17:50 |
|
SQL-gurus, помогите с запросом, плиз! (JOINs)
|
|||
---|---|---|---|
#18+
FROM itementry ie join itembatch ib on (ie.inventorynumber = ib.inventorynumber AND ib.itembatchnumber=ie.itembatchnumber) join (creditor c right join itementry ie on c.creditornumber=ie.thesuppliernumber) может так? ... |
|||
:
Нравится:
Не нравится:
|
|||
29.12.2003, 17:55 |
|
|
start [/forum/topic.php?fid=43&fpage=158&tid=1606385]: |
0ms |
get settings: |
9ms |
get forum list: |
13ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
44ms |
get topic data: |
12ms |
get forum data: |
2ms |
get page messages: |
35ms |
get tp. blocked users: |
2ms |
others: | 310ms |
total: | 435ms |
0 / 0 |