Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2011
    Posts
    34

    Unanswered: create a view with multiple queries?

    Is it possible to create a view from 2 queries? I've been asked to do some monthly reporting and would love to pass this on to a non programmer as a "select * from view"

    The only way I was thinking about doing it was to create a temporary table in the view but not sure if that makes any sense?

    Any kind of advice would be appreciated.

    P.S I'm using DB2 9.7 LUW

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You need to be more specific. What did you try? You cannot create a temp table in a view.

    Andy

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    I agree with Andy.

    Too little information.

    ... asked to do some monthly reporting and would love to pass this on to ...
    I thought UNION ALL these reporting would be an answer.

    ... about doing it was to create a temporary table ...
    But, this statement puzzled me.
    While you need some reporting(it must suggest multiple query results), why a temporary table could be an answer?

  4. #4
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    The result-set of everything you can code into 1 SQL can be defined as user-view. When that is not enough and you feel the need to code compound-SQL you can create a table-function. If that is too hard for your non-programmer you can take the result from that table-function and wrap a user-view around it.
    Back to square 1
    Somewhere between " too small" and " too large" lies the size that is just right.
    - Scott Hayes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •