Any SQL Database gurus - Sajha Mobile
SAJHA MOBILE
Any SQL Database gurus
Posts 4 · Viewed 9019 · Go to Last Post
refugeeNP
· Snapshot 0
Like · Likedby · 0
 What is the difference between WINDOW and GROUP BY clause?


How do you write the query below in SQL:1999 using WINDOW clause that is without using GROUP BY?

SELECT T.year, SUM (S.sales)

FROM Sales S, Times T

WHERE S.timeid = T.timeid

GROUP BY T.year

open
· Snapshot 21
Like · Liked by · 0
 I am not SQL Database guru but just check this works in your case.

SELECT T.year,
SUM (S.sales) OVER (PARTITION BY T.year)

FROM Sales S, Times T

WHERE S.timeid = T.timeid


Just give a try..
 

refugeeNP
· Snapshot 39
Like · Liked by · 0
 Nope It didn't work. Also I want it to be using WINDOW clause in SQL 1999.
Any help will be appreciated.

Also any idea about first qustion??
ketama
· Snapshot 135
Like · Liked by · 0
Why don't you post your questions here. http://www.sqlteam.com/forums/ 
You might get better help there. 
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 3 · Viewed 624
· Posts 5 · Viewed 1691
· Posts 2 · Viewed 396
· Posts 1 · Viewed 199
· Posts 1 · Viewed 212
· Posts 21 · Viewed 4345
· Posts 1 · Viewed 325
· Posts 2 · Viewed 2464
· Posts 3 · Viewed 14523
· Posts 1 · Viewed 269



Travel Partners
Travel House Nepal