View and Grouping

Posted on 2009-02-16
Last Modified: 2012-05-06

I have created a view in SQL that contains a rather complex query.
The query contains a cople of tables, joins etc and grouping

The problem is that it's just one field called ExecutionDate that i don't want for grouping or result
the only thing i want to do is a selection on it.

The problem is when i use the view from a query or from qrystal reports, i can not do a selection on that field since it is not in the views select statement.

How ever inside the view, createing a where clause is no problem

Any ideas?
Question by:MrHswede
    1 Comment
    LVL 92

    Accepted Solution

    Hello MrHswede,

    If you want that column included in the view, then you must include it in the SELECT clause for the view.

    Further, since your view has a GROUP BY clause, that column must either be in the GROUP BY clause as
    well, or used in an aggregate expression in the SELECT clause.



    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now