I am attempting to pull data from a SQL Server table that meets certain criteria. Part of that criteria is that there can be multiple rows with the same data in my column and I need all of those rows returned...what I do not want are rows returned that are distinct.
I want to find a session that is in a specific date range, and meets one of two types of action, and are multiple, meaning there are two or more rows for the session.
Example SQL query:
SELECT activity and message
FROM myTable
WHERE (date BETWEEN '1/1/2020' and '1/31/2020')
AND activity IN ('trace', 'info')
Can you advise how I can grab the rows that meet my criteria of being in the correct date range and with the correct activity, but that have multiple rows only. I want no data that does not meet those three criteria.
Update to Body:
In creating the example query in my initial post, I neglected to include the label column. So the SELECT should read "SELECT activity, label and message FROM myTable WHERE (date BETWEEN '1/1/2020' and '1/31/2020') AND activity IN ('trace','info')". Based on sample data, I would expect the following return:
activity message label
-------- ------- -----
trace logged 1234
info written 1234
Label '1234' is the only value that meets all criteria: falls in the date range, meets activity values and has multiple rows.

editbutton under your question and add the additional information to the body of your question.