I am trying to get only records that are the min date of the orderID
I have the following setup:
select
op.OrderID,
op.id,
MIN(op.Date) AS Date
From OrderPermits op
GROUP BY
Op.OrderId
op.id,
MIN(op.Date) AS Date
Orders has 1 to many order permits.
The problem here is that I am still getting duplicate order Id's when I only want the 1 order ID that is the min(date) for order permits???
Thanks