Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Remove Dups

$
0
0

Hi All,

In my below query creating duplicate records.

SelectMem.*, 2011.[STATUS]as[2011_STATUS], 2012.[STATUS]as[2012_STATUS], 2013.[STATTUS]as[2013_STATUS]

          from  FINALmemleft outerjoin

        YEAR_2011 2011 onleft(mem.ROW_ID,'30') =left(2011.ROW_ID,'30')

        leftouterjoin

        YEAR_2012 2012 onleft(mem.ROW_ID,'30') =left(2012.ROW_ID,'30')

        leftouterjoin

 YEAR_2013 2013 onleft(mem.ROW_ID,'30') =left(2013.ROW_ID,'30')

YEAR_2011,2012,2013 tables have only 2 columns ROW_ID,STATUS

CURRENT MY OUTPUT

DATE      ROW_ID 2011_STATUS    2012_STATUS   2013_STATUS

2011-01-31  12     OVER65           OVER65      OVER65

2011-01-31  12    OVER65           DISABLED     OVER65

2011-01-31  12    OVER65           DISABLED     OVER65

2011-01-31  12    OVER65           DISABLED     OVER65

2011-01-31  12    OVER65           DISABLED     OVER65

2011-01-31  12    OVER65           DISABLED     OVER65

MY DESIRE OUT PUT

I need only one record for particular date

2011-01-31  12     OVER65           OVER65      OVER65

Thanks

CMK


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>