I am wondering if it is possible to reference a view as a subquery instead
of typing the entire SELECT statement.
I have a query with many subqueries that are the same, just used in both the
FROM and WHERE clauses. If I create the subquery as a view, can I reference
the view?
WBDue to missing DDL i suggest you want to that :
Select * from Table1 T1
Left join
Viewname V1 on
T1.COlumn = V1.column
Left join
Viewname V2 on
T1.COlumn = V2.column
Where V1.Condcolumn = Somevalue AND
V2.Condcolumn = Somevalue
HTH (if not post some ddl), Jens Suessmeyer.
http://www.sqlserver2005.de
--
"WB" <none> schrieb im Newsbeitrag
news:uSZy6cNUFHA.2616@.TK2MSFTNGP14.phx.gbl...
>I am wondering if it is possible to reference a view as a subquery instead
> of typing the entire SELECT statement.
> I have a query with many subqueries that are the same, just used in both
> the
> FROM and WHERE clauses. If I create the subquery as a view, can I
> reference
> the view?
> WB
>|||What is DDL?
thank you for verifying I could use the view method. Makes my syntax easier
to read and fewer lines.
WB
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:OfSOimNUFHA.1432@.TK2MSFTNGP09.phx.gbl...
> Due to missing DDL i suggest you want to that :
>
> Select * from Table1 T1
> Left join
> Viewname V1 on
> T1.COlumn = V1.column
> Left join
> Viewname V2 on
> T1.COlumn = V2.column
> Where V1.Condcolumn = Somevalue AND
> V2.Condcolumn = Somevalue
> HTH (if not post some ddl), Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "WB" <none> schrieb im Newsbeitrag
> news:uSZy6cNUFHA.2616@.TK2MSFTNGP14.phx.gbl...
instead
>|||Hi From wwwcoder:
DDL.
DDL stands for Data Definition Language. These are the set of commands that
are used to define the shape of data, and how the data is stored in the
database. These commands also define the structure of database and create
the database objects.
DML
The abbreviated form of Data Modification Language, DML, is used to
define/manipulate the actual data that is stored in the database. This
includes, inserting new data and updating stored data.
DCL
DCL or the Data Control Language, provides you commands by which you can
control access to your data. This includes creating users and granting and
revoking permissions to/from them.
http://www.wwwcoder.com/main/parent...68/default.aspx
HTH, Jens Suessmeyer.
http://www.sqslerver2005.de
"WB" <none> schrieb im Newsbeitrag
news:uiOpRsNUFHA.3140@.TK2MSFTNGP14.phx.gbl...
> What is DDL?
> thank you for verifying I could use the view method. Makes my syntax
> easier
> to read and fewer lines.
> WB
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
> in
> message news:OfSOimNUFHA.1432@.TK2MSFTNGP09.phx.gbl...
> instead
>|||>> If I create the subquery as a view, can I reference the view? <<
Yes, as long as it is un-correlated.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment