Good day. Wrote a request
SELECT dat, ticket,eventtype FROM [DAMASK].[DBO].[Monitor] WHERE dat >= CONVERT(varchar(8), GETDATE(), 112) AND eventtype = 1 AND ticket<>'' ORDER BY id DESC He displays such a table. How to make counting the number of rows in the data column or output the rows value in the end in one cell? Ie I found the right data for me and now I want the number of records in the data column to be output in one cell as a result. Thank you in advance
|id|data| |1 |2015| |2 |2016| |3 |2015| |4 |2015| |5 |2016| |6 |2015| |7 |2016| |8 |2015| |9 |2016|
select count(data) from ..., and if unique, thenselect count(distinct data) from ...And your request, well, how can not issue the table that you brought in the question. In the query you have 3 columns, and here there are two. And then some kind of id field, which is not in the request. And best of all, give the input data and a sample of the weekend so that it would be immediately clear what should come out of it - Mike