September 14, 2008 at 3:51 pm
Hi everyone. Just wondering where is the best place to go to get started writing views in SQL 05. I have written a couple but would like more information on syntax for doing calculations in them. ANyone?
September 14, 2008 at 6:09 pm
Books online is a great place to start... but not knowing the types of calculations you want to do, I can't really point you in the right direction.
What do you have in mind at the moment?
September 14, 2008 at 6:35 pm
Nothing complicated. I owuld like to be able to do the equivilant of dsum and dcount in access. dsum accepts a field name, table name and criteria and will return a sum of the field name. Dcount is the same idea but returns the number of records.
September 14, 2008 at 7:23 pm
check out the sum and count functions on books online (sql sever's help files).
SELECT COUNT(*) AS Total FROM dbo.TableName
SELECT SUM(Amount) AS GrandTotal FROM dbo.TableName
You might also want to check out the group by and having clause as well (if you problem gets more complicated).
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply