dbTalk Databases Forums  

Problem mit Join

comp.databases.btrieve comp.databases.btrieve


Discuss Problem mit Join in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
andreas-boettger@web.de
 
Posts: n/a

Default Problem mit Join - 05-30-2005 , 01:13 AM






Hallo,

ich komme bei folgenden Join nicht weiter. Die einzige richtige Abfrage
ist das Resultat von INactual. Alle anderen summierten Werte, also
COactual, CObudget und INbudget sind ein vielfaches des Wertes was sie
eigentlich sein sollten. Es scheint also so, als wird die Summe der
anderen Spalten nicht nur einmal berechnet, sondern mehrfach. Wie kann
ich denn des Select noch abändern? Will einfach nur die Werte aus 3
versschiedenen Tabellen....

SELECT vmdh.txtype, vmdh.txdesc,vmdh.nmblabrdur, vmdbhd.nmblabrdur,

SUM(vmdh.mnblabrcst+vmdh.mnbsubccst+vmdh.mnbitemcs t+vmdh.mnbservcst+vmdh.mnboverhd)
AS COactual,
SUM(vmdbhd.mnblabrcst+vmdbhd.mnbsubccst+vmdbhd.mnb itemcst+vmdbhd.mnbservcst+vmdbhd.mnboverhd)
AS CObudget,
SUM(vmdtsv.mncompricf) AS INactual,
SUM(vmdbhd.mnblabramt+vmdbhd.mnbsubcamt+vmdbhd.mnb itemamt+vmdbhd.mnbservamt)*vmdh.nmcurrrate
AS INbudget

FROM VMDBHD
Inner JOIN VMDH ON VMDBHD.nmdocid=VMDH.nmdocid
Inner JOIN VMDTSV ON VMDBHD.nmdocid=VMDTSV.nmdocid

WHERE vmdh.txtype = 'C04026'
GROUP BY vmdh.txtype, vmdh.txdesc, vmdh.nmblabrdur, vmdbhd.nmblabrdur,
vmdh.nmcurrrate


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.