I have a table with many records, with columns like this:
under_symbol|quote_date|percent|type
under_symbol is a string,
quote_date is a datetime2,
percent is a float,
type is a char that can be 0 or 1
I need to get the first record in the table for a given month for each under_symbol, where percent > .19 and percent < .21 and type = 1
This returns all of them for each under_symbol, but I just need the first record of the month for each under_symbol that matches it:
SELECT * 
       [under_symbol]
      ,[quote_date]
      ,[type]
      ,[percent]
  FROM [Underlying].[dbo].[Table_EOD]
  where [percent] > .18 and [percent] < .22 and type = '1'
The problem is that I get lots of records for a given month. I just need the one which is the earliest in the month for each unique symbol, for each month, that matches those conditions.
 
     
    