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.
Author |
Topic |
Ondra
Starting Member
1 Post |
Posted - 2014-03-03 : 06:04:51
|
Hi, could anyone please help with with following SQL reguest?Withxy AS (select a,bfrom XXXwhere time=201301),xx AS (select c,d,e,f,gfrom YYYwhere year=2013 and month=1)select a,b,c,d,e,f,gfrom xxleft join xy on xy.a=xx.bThe problem is that I have no idea, how to write one reguest that would generate results for the whole year. So basically I have to rewrite this request for each month (so time=201302 for month=2 etc.)I am sure it is not difficult task, but I can not solve it.Many thanks |
|
kennejd
Starting Member
11 Posts |
Posted - 2014-03-03 : 08:55:46
|
Can you include some sample data? It's difficult to help without it...:) There are numerous ways to filter for a year at a time....where year = 2013....leave out the month. Of course I may be way off base....not knowing exactly what you're trying to achieve. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-03-03 : 11:43:34
|
As i understand you want make filter for full yeariewhere year=2013and the group by year,month to get result for each month------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|