I have records like below in my table.
I want distinct records and when I do group by it loses the Order. I want to maintain the order. I have written below query to get the desired however its not working:
select route_id,fixcode,fixdescription from route_fixcodes group by route_id,fixcode,fixdescription having route_id = 12345 Order by fixcode
I want Result like below:
CREATE TABLE [dbo].[route_fixcodes]( [id] [int] IDENTITY(1,1) NOT NULL, [route_id] [int] NOT NULL, [fixcode] [varchar](4) NOT NULL, [fixdescription] [varchar](32) NOT NULL, CONSTRAINT [PK__route_fi__3213E83FD7609D27] PRIMARY KEY CLUSTERED ([id] ASC) )