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 |
|
KnooKie
Aged Yak Warrior
623 Posts |
Posted - 2001-01-23 : 12:35:42
|
| I have the following piece of SQL that returns 13 records for a company one for each of the last 12 months. Problem - i need to return the company and it's 12 months as one record to a developer. Is there a way of either concatenating them together in a loop ? Putting them into a temp table ? Do i have to use a cursor ? I would rather avoid using a cursor if possible as performance is very important.The following code is part of an SP and displays 13 records per company :-Begin If (SELECT Updated FROM Citywatch_Company C WHERE C.Epic = 'Boots') = 'M' --it's a monthly datafeed SELECT TOP 13 H.Fund_Man as Institution, C.Reg_Date as Interval_Date, H.Pcent as Shares_Outstanding FROM Citywatch_Company_Archive C INNER JOIN Citywatch_Holders_Archive H ON C.Epic = H.Epic AND C.Archive_Date = H.Archive_Date WHERE C.Epic = 'Boots' ORDER BY C.Archive_Date DESCEnd |
|
|
|
|
|