|
Posted by Ryan on 12/21/05 23:51
Hello,
I am trying to create a view that shows the following
Field1: Sum of Amounts from Table A
Field2: Count of Amounts from Table A
Field3: Sum of of Amounts from Table B
Field4: Count of Amounts from Table B
..
..
..
Field3: Sum of of Amounts from Table H
Field4: Count of Amounts from Table H
..
..
..
Things are a bit more complex but this is the gist.
I am using SQL 2000.
I know how to do this pretty easily using a stored procedure. But how
can I do it in a view? A SQL server won't meet my needs in this
situation.
I tried OpenQuery ('myserver', 'exec myprocedure') but get the message
that my server is not configured for data access. I tried the system
stored procedure to set data access to true but nothing seemed to
happen.
I also tried Select * from (
Select Statement1, select statement2
)
but got syntax error at the comma between statement1 and statement2.
Trying to use select Statement1 as ABC to does not seem to work either.
Is there a way to do what I want without making 15 views and then a
final view that shows them all together? I know I could probably do
something by creating a ton of functions, but it really seems this
should not be that hard...
I am definitely open to any easy suggestions!
Thanks,
Ryan
Navigation:
[Reply to this message]
|