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 |
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2007-11-21 : 07:58:04
|
Hi Peso the undisputed king of SQL ,I would like to know whether this solution will work DECLARE @Trans TABLE (TradeDate DATETIME, TransactionType VARCHAR(4), Quantity INT, Symbol VARCHAR(100), Amount MONEY)INSERT @TransSELECT '1/1/2005', 'buy', 100, 'msft', 4000 UNION ALLSELECT '2/1/2005', 'buy', 100, 'ge', 3000 UNION ALLSELECT '3/1/2005', 'sell', 100, 'msft', 3000 UNION ALLSELECT '4/1/2005', 'buy', 100, 'intc', 2200select * from (select tradedate,symbol,transactiontype,row_number()over(partition by transactiontype order by tradedate)as rowid from @trans)t1 where rowid<>1 and TradeDate<'5/1/2005'for the solution you posted for the topic at http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=88633Regards. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-21 : 08:19:26
|
| hmm.. i dare not post an answer... but why didn't you post this in the original thread?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-11-21 : 08:22:34
|
| Crazy idea ... maybe try it?If your programming technique is to write some code, post it on a forum, and then ask people if it will work instead of simply trying it, you will not get far in this business I'm afraid ...- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-21 : 08:23:40
|
Why are we posting here ? I thought this is for Peso ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2007-11-21 : 08:26:24
|
| No hard feelings guys,Guys, I think the original thread is on the 55th page or something like that & it was posted about 3 months back.I accidently came across that post.I just wanted to know whether my solution will work if the number of combinations and rows are more. |
 |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2007-11-21 : 08:31:52
|
quote: Originally posted by jsmith8858 Crazy idea ... maybe try it?If your programming technique is to write some code, post it on a forum, and then ask people if it will work instead of simply trying it, you will not get far in this business I'm afraid ...- Jeffhttp://weblogs.sqlteam.com/JeffS
Yes Smith it is working for the sample data provided & also I have tried it.I just was just looking for an opinion or suggestion from all you masters & gods of SQL. |
 |
|
|
|
|
|
|
|