0
I want to select the amount of Num_CP
according to the current date, so I am using the function GETDATE()
, but my SQL points out the following error:
Only one Expression can be specified in the select list when the subquery is not introduced with EXISTS.
My Code:
BEGIN
SET NOCOUNT ON;
--DECLARE @DM3 DATETIME;
SET @D0 = (SELECT DATEADD(day, 0, GETDATE()) AS D0, COUNT(NUM_CP) AS QUANTIDADE_CPS FROM VW_Vendas);
SELECT CONVERT(VARCHAR, '-')'RESULTADO',
(
SELECT @D0 AS DATA_ATUAL FROM VW_Vendas VW0 WHERE VW0.SITUACAO_RECADO IS NOT NULL
AND VW0.SITUACAO_RECADO LIKE '%Aguardando Aprovação Cliente%' AND
VW0.DT_CRIACAO = GETDATE()
)'DATAS DIA ZERO'
END
GO
I made the changes to my @QUANTIDADE_CPS variable, but now it says my NUM_CP column name is invalid. So I tried using SELECT before Count, and points out that my select syntax is wrong.
– Ana Clara
@Anaclara now that I have seen what you are trying to do. I suggest you share the responsibilities. I will change my answer
– Sorack
I made the changes the way you said, but for some reason, it didn’t work, because the error of only one expression can be specified reappeared.
– Ana Clara
@Anaclara maybe the error is in your view. Add its content to your question
– Sorack