My query as follows
select b.cmn_minor_code as Course,c.cmn_minor_desc as Eligbility,convert(char(12),b.cbm_batch_start_dt,106) as Startdt,
convert(char(12),b.cbm_batch_end_dt,106) as Enddt from tb_rankwise_coursesettings as a,CO_BATCH_MASTER as b,CO_MINOR_MASTER as c
where a.course = b.cmn_minor_code and a.Rank = 'CHENGR' and b.cbm_active <> 'd'
and b.cmn_minor_code = c.cmn_minor_code
and a.Active <> 'd' and b.cbm_batch_start_dt between '2015-08-01 00:00:00.000'
when i run the above query output as follows
Course Eligbility Startdt Enddt
REO CHIEF ENGINEER 10 Aug 2015 21 Aug 2015
REO CHIEF ENGINEER 24 Aug 2015 04 Sep 2015
REO CHIEF ENGINEER 14 Dec 2015 25 Dec 2015
But i want the output as follows
Course Eligbility Startdt Enddt
REO CHIE ENGINEER 10 Aug 2015 21 Aug 2015
24 Aug 2015 04 Sep 2015
14 Dec 2015 25 Dec 2015
for that how to avoid the Course and Eligbility in repeation using my above query
please help me.
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Chandu KumawatPosted Feb 17, 2016, 12:15 AM
Amit Kumar SinghPosted Feb 16, 2016, 11:36 PM
DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2, DuplicateColumn3)