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| 
  • The number of entries in any column is the same. maybe you mean the number of unique values? If the number is simply not NULL values, then select count(data) from ... , and if unique, then select 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
  • Of course, it gives three columns. Just sampling is based on three signs, different signs of values. In the end, I would like to see one cell with a total number of records for column number 2. For example | 107 | - Alexey Novikov
  • I already wrote how to get the amount. something in this does not work? - Mike
  • And specify what your understanding is the number of column two from the number of column 1? - Mike

0