Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select

Author  Topic 

mana
Posting Yak Master

102 Posts

Posted - 2014-09-05 : 05:39:19
i have the below query but it has error can you help me please?

update dbo.Bewegungen_Inventur_Korrekturen
set SumOfMenge=
select SUM(Menge) from dbo.Bewegungen_Inventur_Korrekturen
group by Workcenter,Reason_Code,Datum_Bewegung,Teil_Nummer;

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-09-05 : 05:54:38
[code]UPDATE f
SET SumOfMenge = s
FROM (
SELECT SumofMenge,
SUM(Menge) OVER (PARTITION BY Workcenter, Reason_Code, Datum_Bewegung, Teil_Nummer) AS s
FROM dbo.Bewegungen_Inventur_Korrekturen
) AS f;[/code]


Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

mana
Posting Yak Master

102 Posts

Posted - 2014-09-05 : 07:58:28









thank you for the answer

i have a problem
i want to calculate the
wert as menge from dbo inventur * preis from view-lieferanten-preiscan you help me please?
i dont' know how to write this?
here are the tables::

Bewegungen_Inventur_Korrekturen
Datum_Bewegung datetime Unchecked
Teil_Nummer varchar(20) Unchecked
Workcenter varchar(6) Unchecked
Reason_Code varchar(3) Unchecked
Id_Nr int Unchecked
Menge numeric(11, 3) Checked
Mengeneinheit varchar(2) Checked
Dokumenten_Nummer varchar(8) Checked
Zeit_Bewegung time(0) Checked
SumOfMenge numeric(18, 3) Checked
Anz_Adjustments numeric(18, 0) Checked
Unchecked


v_Lieferanten_Preise
Teil_Nummer Lieferanten_Nummer Lieferanten_Typ Liefer_Quote Preiseinheit Währungseinheit Preis Datum_gültig_Von Datum_gültig_Bis Datum_Eingabe Datum_Änderung Preis_Typ Modif_User Modif_Datum Modif_Status
000079041845 GQ067 1 0 EA EUR 19137.583 2012-07-16 00:00:00.000 9999-12-31 00:00:00.000 2012-07-16 00:00:00.000 2012-07-19 00:00:00.000 dbo 2014-09-04 21:32:37.537 1










quote:
Originally posted by mana

i have the below query but it has error can you help me please?

update dbo.Bewegungen_Inventur_Korrekturen
set SumOfMenge=
select SUM(Menge) from dbo.Bewegungen_Inventur_Korrekturen
group by Workcenter,Reason_Code,Datum_Bewegung,Teil_Nummer;

Go to Top of Page

mana
Posting Yak Master

102 Posts

Posted - 2014-09-05 : 08:00:45

wert is a column in dbo.Bewegungen_Inventur_Korrekturen



quote:
Originally posted by mana










thank you for the answer

i have a problem
i want to calculate the
wert as menge from dbo inventur * preis from view-lieferanten-preiscan you help me please?
i dont' know how to write this?
here are the tables::

Bewegungen_Inventur_Korrekturen
Datum_Bewegung datetime Unchecked
Teil_Nummer varchar(20) Unchecked
Workcenter varchar(6) Unchecked
Reason_Code varchar(3) Unchecked
Id_Nr int Unchecked
Menge numeric(11, 3) Checked
Mengeneinheit varchar(2) Checked
Dokumenten_Nummer varchar(8) Checked
Zeit_Bewegung time(0) Checked
SumOfMenge numeric(18, 3) Checked
Anz_Adjustments numeric(18, 0) Checked
Unchecked


v_Lieferanten_Preise
Teil_Nummer Lieferanten_Nummer Lieferanten_Typ Liefer_Quote Preiseinheit Währungseinheit Preis Datum_gültig_Von Datum_gültig_Bis Datum_Eingabe Datum_Änderung Preis_Typ Modif_User Modif_Datum Modif_Status
000079041845 GQ067 1 0 EA EUR 19137.583 2012-07-16 00:00:00.000 9999-12-31 00:00:00.000 2012-07-16 00:00:00.000 2012-07-19 00:00:00.000 dbo 2014-09-04 21:32:37.537 1










quote:
Originally posted by mana

i have the below query but it has error can you help me please?

update dbo.Bewegungen_Inventur_Korrekturen
set SumOfMenge=
select SUM(Menge) from dbo.Bewegungen_Inventur_Korrekturen
group by Workcenter,Reason_Code,Datum_Bewegung,Teil_Nummer;



Go to Top of Page
   

- Advertisement -