SQL Views - Variables
CREATE VIEW VW_X
AS
WITH MyVars (AnoInit, AnoEnd)
AS (
SELECT
2010 AS 'AnoInit',
(SELECT TOP 1 AnoLetivo FROM TB_Anos) AS 'AnoEnd'
)
SELECT
AnoX,
(SELECT AnoInit FROM MyVars) as AnoInit,
(SELECT AnoEnd FROM MyVars) as AnoEnd
FROM TABLE
GO
Comments
Post a Comment