Subject | SQL Question |
---|---|
Author | Michael Vilhelmsen |
Post date | 2005-04-08T11:48:18Z |
Hi
An SQL statement like the below, will it make 4 sub selects for each
record in table VD ?
If Yes - Can it be modified to only make one select for each record ?
Update VD set
VD.Antal =
(select
SUM(VV.Antal)
from VV where
VV.VNr=VD.VNr AND VV.ANr=VD.ANr),
VD.beh_kostpris =
(select
SUM(VV.beh_kostpris)
from VV where
VV.VNr=VD.VNr AND VV.ANr=VD.ANr),
VD.beh_salgspris =
(select
SUM(VV.beh_salgspris)
from VV where
VV.VNr=VD.VNr AND VV.ANr=VD.ANr),
VD.beh_salgsprismoms =
(select
SUM(VV.beh_salgsprismoms)
from VV where VV.VNr=VD.VNr AND VV.ANr=VD.ANr)
Michael
An SQL statement like the below, will it make 4 sub selects for each
record in table VD ?
If Yes - Can it be modified to only make one select for each record ?
Update VD set
VD.Antal =
(select
SUM(VV.Antal)
from VV where
VV.VNr=VD.VNr AND VV.ANr=VD.ANr),
VD.beh_kostpris =
(select
SUM(VV.beh_kostpris)
from VV where
VV.VNr=VD.VNr AND VV.ANr=VD.ANr),
VD.beh_salgspris =
(select
SUM(VV.beh_salgspris)
from VV where
VV.VNr=VD.VNr AND VV.ANr=VD.ANr),
VD.beh_salgsprismoms =
(select
SUM(VV.beh_salgsprismoms)
from VV where VV.VNr=VD.VNr AND VV.ANr=VD.ANr)
Michael