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 |
chamank
Starting Member
2 Posts |
Posted - 2010-09-08 : 11:39:43
|
I am having problem in displaying the result set in the required format. Background Info:User selects main date and number of different dates (no fixed number of dates – dynamic) for comparisonIn the following example, the main date is 20100803 and 2 selected date’s .i.e. 20100519 & 20100729 but please note this is user defined and we can have more than three dates.Ideally, I would like to have just one record per ISIN showing main date, main price and price diff for each selected date.CREATE TABLE dbo.PricingData( [ISIN] [varchar](50) NOT NULL, [MainDate] [varchar](50) NOT NULL, [SelDate] [varchar](50) NOT NULL, MainPrice [float] NOT NULL,SelPrice [float] NOT NULL, PriceDiff [float] NOT NULL)INSERT INTO PricingDataVALUES('AU0000CBAHL7','20100803','20100519',101.19, 101.73,-0.54)INSERT INTO PricingDataVALUES('AU0000CBAHL7','20100803','20100729',101.19, 101.19,0.0069)SELECT * FROM PricingData--Current Result:ISIN MainDate SelDate MainPrice SelPrice PriceDiffAU0000CBAHL7 20100803 20100519 101.19 101.73 -0.54AU0000CBAHL7 20100803 20100729 101.19 101.19 0.0069--Required Result:ISIN 20100803 20100519 20100729 – Column names AU0000CBAHL7 101.19 -0.541 0.0069I would appreciate your help on this matter.Any questions please let me know.Thanks in advanceCheersChaman |
|
sql-programmers
Posting Yak Master
190 Posts |
Posted - 2010-09-09 : 08:11:10
|
ISIN 20100803 20100519 20100729 – Column namesAU0000CBAHL7 101.19 -0.541 0.0069What the "Column names" means , Explain in detailSQL Server Programmers and Consultantshttp://www.sql-programmers.com/ |
 |
|
chamank
Starting Member
2 Posts |
Posted - 2010-09-10 : 09:28:09
|
Sorry for the confursion.Just to indicate that line as Column names.Please ignore "Column names".ISIN 20100803 20100519 20100729 AU0000CBAHL7 101.19 -0.541 0.0069 |
 |
|
|
|
|
|
|