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.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Witre t-sql query

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-01-15 : 07:11:17
hi
im new to t-sql what would be the best way to write this.

any help would be great


select all Columns , the sum of “Value” as TOTVAL and the sum of UNValue as TOTUNVAL and the sum of “Shares” as TotShrs From the second dataload and place into “Futures” table Group the results by their “Fund”,”CUSIP” and “Pos_typ” So long as the list contains 70-75 order the results by their “fund” and “CUSIP”
Select the “futures” and replace the Value column with TotVal Replace Unval with TotUnVale Replace Shares with TotShares in the futures table
Select the “futures” Replace all the CUSIPs on futures with a pos_typ of “S”

Select the second dataload Delete all in the list that are between 70 and 75

Select the second dataload Append the selected data to the futures table
End the process and rollup the futures

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-15 : 08:03:31
replace the sentences with corresponding SQL commands like SELECT,UPDATE and DELETE
have a look at books online for syntaxes
Make a try and post if you face any issue

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -