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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 sql

Author  Topic 

mana
Posting Yak Master

102 Posts

Posted - 2014-07-25 : 07:13:13
Hello I have the below code but the result is not that i want
can you helo me please?
UPDATE AMPPU_Alle_Fehlteile SET
summenew2 = avg_bereich
FROM AMPPU_Alle_Fehlteile A
INNER JOIN (select Offline_date,Bereich,AVG(ARTPU1) AS avg_bereich FROM
AMPPU_Alle_Fehlteile group by Offline_date,Bereich,
YEAR(Offline_date), MONTH(Offline_date)) B
ON MONTH(A.Offline_date) = MONTH (B.Offline_date) and
YEAR(A.Offline_date) = YEAR(B.Offline_date) ;

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-07-25 : 09:29:39
To hello you with this, please post:

1. CREATE TABLE commands to create the tables for your query
2. INSERT INTO commands to populate the tables with test data
3. The results you are getting from your query when executed against these tables
4. The results you want.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-07-25 : 12:31:21
http://www.sqlservercentral.com/articles/Best+Practices/61537/

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -