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 |
|
mahimam_2004
Starting Member
40 Posts |
Posted - 2007-03-12 : 17:39:13
|
| Hi , I have the following query, Select * from DB2006.dbo.rptfunChronicity('Dec 15 2005 12:00AM','Jan 31 2006 12:00AM',97,010) Union Select * from DB2007.dbo.rptfunChronicity('Dec 15 2005 12:00AM','Jan 31 2006 12:00AM',97,010)Now the query returning the results like this:Number ID Desc9 3 Chronic13 2 Acute-on-chronic15 2 Acute-on-chronic24 3 Chronic1793 1 Acute3456 1 AcuteFrom the above result I need to get Number ID Desc33 3 Chronic28 2 Acute-on-chronic 5249 1 AcuteGrouped by ID value.Thanks in advance |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-03-12 : 18:03:12
|
| something like select sum(number), id, desc from(Select * from DB2006.dbo.rptfunChronicity('Dec 15 2005 12:00AM','Jan 31 2006 12:00AM',97,010) Union Select * from DB2007.dbo.rptfunChronicity('Dec 15 2005 12:00AM','Jan 31 2006 12:00AM',97,010)) as xgroup by id, desc May I suggest you also get rid of your multiple databases and start spraying a year column around. |
 |
|
|
|
|
|
|
|